All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] parport: use standard kernel printing functions
@ 2024-10-25  8:21 412574090
  2024-10-25  8:21 ` [PATCH 2/4] parport: change struct parport member to iobase 412574090
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: 412574090 @ 2024-10-25  8:21 UTC (permalink / raw)
  To: sudipm.mukherjee; +Cc: linux-kernel, xiongxin, weiyufeng

From: weiyufeng <weiyufeng@kylinos.cn>

change printk to standard kernel printing functions.

Signed-off-by: weiyufeng <weiyufeng@kylinos.cn>
---
 drivers/net/hamradio/baycom_epp.c |  8 ++++----
 drivers/net/hamradio/baycom_par.c |  6 +++---
 drivers/parport/parport_pc.c      | 12 ++++++------
 drivers/parport/procfs.c          |  2 +-
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 9e366f275406..1b7fd6d49a96 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -828,13 +828,13 @@ static int epp_open(struct net_device *dev)
         }
 #if 0
         if (pp->irq < 0) {
-                printk(KERN_ERR "%s: parport at 0x%lx has no irq\n", bc_drvname, pp->base);
+		pr_err("%s: parport at 0x%lx has no irq\n", bc_drvname, pp->base);
 		parport_put_port(pp);
                 return -ENXIO;
         }
 #endif
 	if ((~pp->modes) & (PARPORT_MODE_TRISTATE | PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT)) {
-                printk(KERN_ERR "%s: parport at 0x%lx cannot be used\n",
+		pr_err("%s: parport at 0x%lx cannot be used\n",
 		       bc_drvname, pp->base);
 		parport_put_port(pp);
                 return -EIO;
@@ -857,11 +857,11 @@ static int epp_open(struct net_device *dev)
 	bc->pdev = parport_register_dev_model(pp, dev->name, &par_cb, i);
 	parport_put_port(pp);
         if (!bc->pdev) {
-                printk(KERN_ERR "%s: cannot register parport at 0x%lx\n", bc_drvname, pp->base);
+		pr_err("%s: cannot register parport at 0x%lx\n", bc_drvname, pp->base);
                 return -ENXIO;
         }
         if (parport_claim(bc->pdev)) {
-                printk(KERN_ERR "%s: parport at 0x%lx busy\n", bc_drvname, pp->base);
+		pr_err("%s: parport at 0x%lx busy\n", bc_drvname, pp->base);
                 parport_unregister_device(bc->pdev);
                 return -EBUSY;
         }
diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c
index 00ebc25d0b22..4b57874c2463 100644
--- a/drivers/net/hamradio/baycom_par.c
+++ b/drivers/net/hamradio/baycom_par.c
@@ -307,12 +307,12 @@ static int par96_open(struct net_device *dev)
 		return -ENXIO;
 	}
 	if (pp->irq < 0) {
-		printk(KERN_ERR "baycom_par: parport at 0x%lx has no irq\n", pp->base);
+		pr_err("baycom_par: parport at 0x%lx has no irq\n", pp->base);
 		parport_put_port(pp);
 		return -ENXIO;
 	}
 	if ((~pp->modes) & (PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT)) {
-		printk(KERN_ERR "baycom_par: parport at 0x%lx cannot be used\n", pp->base);
+		pr_err("baycom_par: parport at 0x%lx cannot be used\n", pp->base);
 		parport_put_port(pp);
 		return -ENXIO;
 	}
@@ -339,7 +339,7 @@ static int par96_open(struct net_device *dev)
 		return -ENXIO;
 	}
 	if (parport_claim(bc->pdev)) {
-		printk(KERN_ERR "baycom_par: parport at 0x%lx busy\n", pp->base);
+		pr_err("baycom_par: parport at 0x%lx busy\n", pp->base);
 		parport_unregister_device(bc->pdev);
 		return -EBUSY;
 	}
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index f33b5d1ddfc1..609c10d4bc31 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -1609,7 +1609,7 @@ static int parport_ECP_supported(struct parport *pb)
 
 	priv->fifo_depth = i;
 	if (verbose_probing)
-		printk(KERN_DEBUG "0x%lx: FIFO is %d bytes\n", pb->base, i);
+		pr_debug("0x%lx: FIFO is %d bytes\n", pb->base, i);
 
 	/* Find out writeIntrThreshold */
 	frob_econtrol(pb, 1<<2, 1<<2);
@@ -1623,7 +1623,7 @@ static int parport_ECP_supported(struct parport *pb)
 
 	if (i <= priv->fifo_depth) {
 		if (verbose_probing)
-			printk(KERN_DEBUG "0x%lx: writeIntrThreshold is %d\n",
+			pr_debug("0x%lx: writeIntrThreshold is %d\n",
 			       pb->base, i);
 	} else
 		/* Number of bytes we know we can write if we get an
@@ -1676,16 +1676,16 @@ static int parport_ECP_supported(struct parport *pb)
 	priv->pword = pword;
 
 	if (verbose_probing) {
-		printk(KERN_DEBUG "0x%lx: PWord is %d bits\n",
+		pr_debug("0x%lx: PWord is %d bits\n",
 		       pb->base, 8 * pword);
 
-		printk(KERN_DEBUG "0x%lx: Interrupts are ISA-%s\n",
+		pr_debug("0x%lx: Interrupts are ISA-%s\n",
 		       pb->base, config & 0x80 ? "Level" : "Pulses");
 
 		configb = inb(CONFIGB(pb));
-		printk(KERN_DEBUG "0x%lx: ECP port cfgA=0x%02x cfgB=0x%02x\n",
+		pr_debug("0x%lx: ECP port cfgA=0x%02x cfgB=0x%02x\n",
 		       pb->base, config, configb);
-		printk(KERN_DEBUG "0x%lx: ECP settings irq=", pb->base);
+		pr_debug("0x%lx: ECP settings irq=", pb->base);
 		if ((configb >> 3) & 0x07)
 			pr_cont("%d", intrline[(configb >> 3) & 0x07]);
 		else
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 3880460e67f2..3f809fff317b 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -128,7 +128,7 @@ static int do_hardware_base_addr(const struct ctl_table *table, int write,
 	if (write) /* permissions prevent this anyway */
 		return -EACCES;
 
-	len += scnprintf (buffer, sizeof(buffer), "%lu\t%lu\n", port->base, port->base_hi);
+	len += scnprintf(buffer, sizeof(buffer), "%lu\t%lu\n", port->base, port->base_hi);
 
 	if (len > *lenp)
 		len = *lenp;
-- 
2.25.1


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

* [PATCH 2/4] parport: change struct parport member to iobase
  2024-10-25  8:21 [PATCH 1/4] parport: use standard kernel printing functions 412574090
@ 2024-10-25  8:21 ` 412574090
  2024-10-25 21:58   ` kernel test robot
  2024-10-25 22:29   ` kernel test robot
  2024-10-25  8:21 ` [PATCH 3/4] parport: add parport_data struct 412574090
  2024-10-25  8:21 ` [PATCH 4/4] parport: add iomem type for parport 412574090
  2 siblings, 2 replies; 6+ messages in thread
From: 412574090 @ 2024-10-25  8:21 UTC (permalink / raw)
  To: sudipm.mukherjee; +Cc: linux-kernel, xiongxin, weiyufeng

From: weiyufeng <weiyufeng@kylinos.cn>

change struct parport member base and base_hi to iobase and iobase_hi
for ioport. because iomem type will be added, in that case,mapbase,
mapbase_hi will be added in struct parport. this can distinguish between
these two types.

Signed-off-by: weiyufeng <weiyufeng@kylinos.cn>
---
 drivers/auxdisplay/ks0108.c       |  4 +--
 drivers/net/hamradio/baycom_epp.c | 10 ++++----
 drivers/net/hamradio/baycom_par.c |  6 ++---
 drivers/net/plip/plip.c           |  2 +-
 drivers/parport/daisy.c           |  2 +-
 drivers/parport/parport_gsc.c     |  8 +++---
 drivers/parport/parport_ip32.c    |  8 +++---
 drivers/parport/parport_pc.c      | 42 +++++++++++++++----------------
 drivers/parport/parport_sunbpp.c  | 24 +++++++++---------
 drivers/parport/procfs.c          |  2 +-
 drivers/parport/share.c           |  6 ++---
 drivers/scsi/imm.c                |  8 +++---
 drivers/scsi/ppa.c                | 10 ++++----
 include/linux/parport.h           |  4 +--
 include/linux/parport_pc.h        | 18 ++++++-------
 sound/drivers/mts64.c             |  6 ++---
 sound/drivers/portman2x4.c        |  6 ++---
 17 files changed, 82 insertions(+), 84 deletions(-)

diff --git a/drivers/auxdisplay/ks0108.c b/drivers/auxdisplay/ks0108.c
index 51587f0fdaae..ee046955ac2d 100644
--- a/drivers/auxdisplay/ks0108.c
+++ b/drivers/auxdisplay/ks0108.c
@@ -112,7 +112,7 @@ static void ks0108_parport_attach(struct parport *port)
 {
 	struct pardev_cb ks0108_cb;
 
-	if (port->base != ks0108_port)
+	if (port->iobase != ks0108_port)
 		return;
 
 	memset(&ks0108_cb, 0, sizeof(ks0108_cb));
@@ -140,7 +140,7 @@ static void ks0108_parport_attach(struct parport *port)
 
 static void ks0108_parport_detach(struct parport *port)
 {
-	if (port->base != ks0108_port)
+	if (port->iobase != ks0108_port)
 		return;
 
 	if (!ks0108_pardevice) {
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 1b7fd6d49a96..0b070ee7016a 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -306,7 +306,7 @@ static int eppconfig(struct baycom_state *bc)
 		bc->cfg.extmodem ? "ext" : "int", bc->cfg.fclk, bc->cfg.bps,
 		(bc->cfg.fclk + 8 * bc->cfg.bps) / (16 * bc->cfg.bps),
 		bc->cfg.loopback ? ",loopback" : "");
-	sprintf(portarg, "%ld", bc->pdev->port->base);
+	sprintf(portarg, "%ld", bc->pdev->port->iobase);
 	printk(KERN_DEBUG "%s: %s -s -p %s -m %s\n", bc_drvname, eppconfig_path, portarg, modearg);
 
 	return call_usermodehelper(eppconfig_path, argv, envp, UMH_WAIT_PROC);
@@ -828,14 +828,14 @@ static int epp_open(struct net_device *dev)
         }
 #if 0
         if (pp->irq < 0) {
-		pr_err("%s: parport at 0x%lx has no irq\n", bc_drvname, pp->base);
+		pr_err("%s: parport at 0x%lx has no irq\n", bc_drvname, pp->iobase);
 		parport_put_port(pp);
                 return -ENXIO;
         }
 #endif
 	if ((~pp->modes) & (PARPORT_MODE_TRISTATE | PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT)) {
 		pr_err("%s: parport at 0x%lx cannot be used\n",
-		       bc_drvname, pp->base);
+		       bc_drvname, pp->iobase);
 		parport_put_port(pp);
                 return -EIO;
 	}
@@ -857,11 +857,11 @@ static int epp_open(struct net_device *dev)
 	bc->pdev = parport_register_dev_model(pp, dev->name, &par_cb, i);
 	parport_put_port(pp);
         if (!bc->pdev) {
-		pr_err("%s: cannot register parport at 0x%lx\n", bc_drvname, pp->base);
+		pr_err("%s: cannot register parport at 0x%lx\n", bc_drvname, pp->iobase);
                 return -ENXIO;
         }
         if (parport_claim(bc->pdev)) {
-		pr_err("%s: parport at 0x%lx busy\n", bc_drvname, pp->base);
+		pr_err("%s: parport at 0x%lx busy\n", bc_drvname, pp->iobase);
                 parport_unregister_device(bc->pdev);
                 return -EBUSY;
         }
diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c
index 4b57874c2463..4fc324a28c86 100644
--- a/drivers/net/hamradio/baycom_par.c
+++ b/drivers/net/hamradio/baycom_par.c
@@ -307,12 +307,12 @@ static int par96_open(struct net_device *dev)
 		return -ENXIO;
 	}
 	if (pp->irq < 0) {
-		pr_err("baycom_par: parport at 0x%lx has no irq\n", pp->base);
+		pr_err("baycom_par: parport at 0x%lx has no irq\n", pp->iobase);
 		parport_put_port(pp);
 		return -ENXIO;
 	}
 	if ((~pp->modes) & (PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT)) {
-		pr_err("baycom_par: parport at 0x%lx cannot be used\n", pp->base);
+		pr_err("baycom_par: parport at 0x%lx cannot be used\n", pp->iobase);
 		parport_put_port(pp);
 		return -ENXIO;
 	}
@@ -339,7 +339,7 @@ static int par96_open(struct net_device *dev)
 		return -ENXIO;
 	}
 	if (parport_claim(bc->pdev)) {
-		pr_err("baycom_par: parport at 0x%lx busy\n", pp->base);
+		pr_err("baycom_par: parport at 0x%lx busy\n", pp->iobase);
 		parport_unregister_device(bc->pdev);
 		return -EBUSY;
 	}
diff --git a/drivers/net/plip/plip.c b/drivers/net/plip/plip.c
index e39bfaefe8c5..80ac7ca816b9 100644
--- a/drivers/net/plip/plip.c
+++ b/drivers/net/plip/plip.c
@@ -1286,7 +1286,7 @@ static void plip_attach (struct parport *port)
 		strcpy(dev->name, name);
 
 		dev->irq = port->irq;
-		dev->base_addr = port->base;
+		dev->base_addr = port->iobase;
 		if (port->irq == -1) {
 			printk(KERN_INFO "plip: %s has no IRQ. Using IRQ-less mode,"
 		                 "which is fairly inefficient!\n", port->name);
diff --git a/drivers/parport/daisy.c b/drivers/parport/daisy.c
index 2231dbfd870d..83502170a6ba 100644
--- a/drivers/parport/daisy.c
+++ b/drivers/parport/daisy.c
@@ -68,7 +68,7 @@ static void add_dev(int devnum, struct parport *port, int daisy)
 /* Clone a parport (actually, make an alias). */
 static struct parport *clone_parport(struct parport *real, int muxport)
 {
-	struct parport *extra = parport_register_port(real->base,
+	struct parport *extra = parport_register_port(real->iobase,
 						       real->irq,
 						       real->dma,
 						       real->ops);
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index c7e18382dc01..9490c431bd6c 100644
--- a/drivers/parport/parport_gsc.c
+++ b/drivers/parport/parport_gsc.c
@@ -249,8 +249,8 @@ static struct parport *parport_gsc_probe_port(unsigned long base,
 	}
 	priv->ctr = 0xc;
 	priv->ctr_writable = 0xff;
-	p->base = base;
-	p->base_hi = base_hi;
+	p->iobase = base;
+	p->iobase_hi = base_hi;
 	p->irq = irq;
 	p->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT;
 	p->ops = ops;
@@ -272,12 +272,12 @@ static struct parport *parport_gsc_probe_port(unsigned long base,
 	}
 
 	p->dev = &padev->dev;
-	p->base_hi = base_hi;
+	p->iobase_hi = base_hi;
 	p->modes = tmp.modes;
 	p->size = (p->modes & PARPORT_MODE_EPP)?8:3;
 	p->private_data = priv;
 
-	pr_info("%s: PC-style at 0x%lx", p->name, p->base);
+	pr_info("%s: PC-style at 0x%lx", p->name, p->iobase);
 	p->irq = irq;
 	if (p->irq == PARPORT_IRQ_AUTO) {
 		p->irq = PARPORT_IRQ_NONE;
diff --git a/drivers/parport/parport_ip32.c b/drivers/parport/parport_ip32.c
index 0919ed99ba94..44150fe2d0ed 100644
--- a/drivers/parport/parport_ip32.c
+++ b/drivers/parport/parport_ip32.c
@@ -301,7 +301,7 @@ struct parport_ip32_private {
 #define __pr_probe(...)							\
 	do { if (verbose_probing) printk(__VA_ARGS__); } while (0)
 #define pr_probe(p, fmt, ...)						\
-	__pr_probe(KERN_INFO PPIP32 "0x%lx: " fmt, (p)->base , ##__VA_ARGS__)
+	__pr_probe(KERN_INFO PPIP32 "0x%lx: " fmt, (p)->iobase, ##__VA_ARGS__)
 
 /*
  * parport_ip32_dump_state - print register status of parport
@@ -2038,8 +2038,8 @@ static __init struct parport *parport_ip32_probe_port(void)
 		err = -ENOMEM;
 		goto fail;
 	}
-	p->base = MACE_BASE + offsetof(struct sgi_mace, isa.parallel);
-	p->base_hi = MACE_BASE + offsetof(struct sgi_mace, isa.ecp1284);
+	p->iobase = MACE_BASE + offsetof(struct sgi_mace, isa.parallel);
+	p->iobase_hi = MACE_BASE + offsetof(struct sgi_mace, isa.ecp1284);
 	p->private_data = priv;
 
 	*ops = parport_ip32_ops;
@@ -2131,7 +2131,7 @@ static __init struct parport *parport_ip32_probe_port(void)
 	parport_ip32_dump_state(p, "end init", 0);
 
 	/* Print out what we found */
-	pr_info("%s: SGI IP32 at 0x%lx (0x%lx)", p->name, p->base, p->base_hi);
+	pr_info("%s: SGI IP32 at 0x%lx (0x%lx)", p->name, p->iobase, p->iobase_hi);
 	if (p->irq != PARPORT_IRQ_NONE)
 		pr_cont(", irq %d", p->irq);
 	pr_cont(" [");
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 609c10d4bc31..160d87449913 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -1380,7 +1380,7 @@ static struct superio_struct *find_superio(struct parport *p)
 {
 	int i;
 	for (i = 0; i < NR_SUPERIOS; i++)
-		if (superios[i].io == p->base)
+		if (superios[i].io == p->iobase)
 			return &superios[i];
 	return NULL;
 }
@@ -1448,7 +1448,7 @@ static int parport_SPP_supported(struct parport *pb)
 		/* That didn't work, but the user thinks there's a
 		 * port here. */
 		pr_info("parport 0x%lx (WARNING): CTR: wrote 0x%02x, read 0x%02x\n",
-			pb->base, w, r);
+			pb->iobase, w, r);
 
 	/* Try the data register.  The data lines aren't tri-stated at
 	 * this stage, so we expect back what we wrote. */
@@ -1467,9 +1467,9 @@ static int parport_SPP_supported(struct parport *pb)
 		/* Didn't work, but the user is convinced this is the
 		 * place. */
 		pr_info("parport 0x%lx (WARNING): DATA: wrote 0x%02x, read 0x%02x\n",
-			pb->base, w, r);
+			pb->iobase, w, r);
 		pr_info("parport 0x%lx: You gave this address, but there is probably no parallel port there!\n",
-			pb->base);
+			pb->iobase);
 	}
 
 	/* It's possible that we can't read the control register or
@@ -1609,7 +1609,7 @@ static int parport_ECP_supported(struct parport *pb)
 
 	priv->fifo_depth = i;
 	if (verbose_probing)
-		pr_debug("0x%lx: FIFO is %d bytes\n", pb->base, i);
+		pr_debug("0x%lx: FIFO is %d bytes\n", pb->iobase, i);
 
 	/* Find out writeIntrThreshold */
 	frob_econtrol(pb, 1<<2, 1<<2);
@@ -1624,7 +1624,7 @@ static int parport_ECP_supported(struct parport *pb)
 	if (i <= priv->fifo_depth) {
 		if (verbose_probing)
 			pr_debug("0x%lx: writeIntrThreshold is %d\n",
-			       pb->base, i);
+			       pb->iobase, i);
 	} else
 		/* Number of bytes we know we can write if we get an
 		   interrupt. */
@@ -1647,7 +1647,7 @@ static int parport_ECP_supported(struct parport *pb)
 	if (i <= priv->fifo_depth) {
 		if (verbose_probing)
 			pr_info("0x%lx: readIntrThreshold is %d\n",
-				pb->base, i);
+				pb->iobase, i);
 	} else
 		/* Number of bytes we can read if we get an interrupt. */
 		i = 0;
@@ -1661,14 +1661,14 @@ static int parport_ECP_supported(struct parport *pb)
 	switch (pword) {
 	case 0:
 		pword = 2;
-		pr_warn("0x%lx: Unsupported pword size!\n", pb->base);
+		pr_warn("0x%lx: Unsupported pword size!\n", pb->iobase);
 		break;
 	case 2:
 		pword = 4;
-		pr_warn("0x%lx: Unsupported pword size!\n", pb->base);
+		pr_warn("0x%lx: Unsupported pword size!\n", pb->iobase);
 		break;
 	default:
-		pr_warn("0x%lx: Unknown implementation ID\n", pb->base);
+		pr_warn("0x%lx: Unknown implementation ID\n", pb->iobase);
 		fallthrough;	/* Assume 1 */
 	case 1:
 		pword = 1;
@@ -1677,15 +1677,15 @@ static int parport_ECP_supported(struct parport *pb)
 
 	if (verbose_probing) {
 		pr_debug("0x%lx: PWord is %d bits\n",
-		       pb->base, 8 * pword);
+		       pb->iobase, 8 * pword);
 
 		pr_debug("0x%lx: Interrupts are ISA-%s\n",
-		       pb->base, config & 0x80 ? "Level" : "Pulses");
+		       pb->iobase, config & 0x80 ? "Level" : "Pulses");
 
 		configb = inb(CONFIGB(pb));
 		pr_debug("0x%lx: ECP port cfgA=0x%02x cfgB=0x%02x\n",
-		       pb->base, config, configb);
-		pr_debug("0x%lx: ECP settings irq=", pb->base);
+		       pb->iobase, config, configb);
+		pr_debug("0x%lx: ECP settings irq=", pb->iobase);
 		if ((configb >> 3) & 0x07)
 			pr_cont("%d", intrline[(configb >> 3) & 0x07]);
 		else
@@ -2085,7 +2085,7 @@ static struct parport *__parport_pc_probe_port(unsigned long int base,
 	priv->port = p;
 
 	p->dev = dev;
-	p->base_hi = base_hi;
+	p->iobase_hi = base_hi;
 	p->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT;
 	p->private_data = priv;
 
@@ -2111,9 +2111,9 @@ static struct parport *__parport_pc_probe_port(unsigned long int base,
 
 	p->size = (p->modes & PARPORT_MODE_EPP) ? 8 : 3;
 
-	pr_info("%s: PC-style at 0x%lx", p->name, p->base);
-	if (p->base_hi && priv->ecr)
-		pr_cont(" (0x%lx)", p->base_hi);
+	pr_info("%s: PC-style at 0x%lx", p->name, p->iobase);
+	if (p->iobase_hi && priv->ecr)
+		pr_cont(" (0x%lx)", p->iobase_hi);
 	if (p->irq == PARPORT_IRQ_AUTO) {
 		p->irq = PARPORT_IRQ_NONE;
 		parport_irq_probe(p);
@@ -2299,11 +2299,11 @@ void parport_pc_unregister_port(struct parport *p)
 #endif
 	if (p->irq != PARPORT_IRQ_NONE)
 		free_irq(p->irq, p);
-	release_region(p->base, 3);
+	release_region(p->iobase, 3);
 	if (p->size > 3)
-		release_region(p->base + 3, p->size - 3);
+		release_region(p->iobase + 3, p->size - 3);
 	if (p->modes & PARPORT_MODE_ECP)
-		release_region(p->base_hi, 3);
+		release_region(p->iobase_hi, 3);
 #if defined(CONFIG_PARPORT_PC_FIFO) && defined(HAS_DMA)
 	if (priv->dma_buf)
 		dma_free_coherent(p->physport->dev, PAGE_SIZE,
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index 949236a7a27c..c7a56a0b04a0 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -50,7 +50,7 @@
 
 static void parport_sunbpp_disable_irq(struct parport *p)
 {
-	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
+	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->iobase;
 	u32 tmp;
 
 	tmp = sbus_readl(&regs->p_csr);
@@ -60,7 +60,7 @@ static void parport_sunbpp_disable_irq(struct parport *p)
 
 static void parport_sunbpp_enable_irq(struct parport *p)
 {
-	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
+	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->iobase;
 	u32 tmp;
 
 	tmp = sbus_readl(&regs->p_csr);
@@ -70,7 +70,7 @@ static void parport_sunbpp_enable_irq(struct parport *p)
 
 static void parport_sunbpp_write_data(struct parport *p, unsigned char d)
 {
-	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
+	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->iobase;
 
 	sbus_writeb(d, &regs->p_dr);
 	dprintk((KERN_DEBUG "wrote 0x%x\n", d));
@@ -78,14 +78,14 @@ static void parport_sunbpp_write_data(struct parport *p, unsigned char d)
 
 static unsigned char parport_sunbpp_read_data(struct parport *p)
 {
-	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
+	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->iobase;
 
 	return sbus_readb(&regs->p_dr);
 }
 
 static unsigned char status_sunbpp_to_pc(struct parport *p)
 {
-	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
+	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->iobase;
 	unsigned char bits = 0;
 	unsigned char value_tcr = sbus_readb(&regs->p_tcr);
 	unsigned char value_ir = sbus_readb(&regs->p_ir);
@@ -108,7 +108,7 @@ static unsigned char status_sunbpp_to_pc(struct parport *p)
 
 static unsigned char control_sunbpp_to_pc(struct parport *p)
 {
-	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
+	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->iobase;
 	unsigned char bits = 0;
 	unsigned char value_tcr = sbus_readb(&regs->p_tcr);
 	unsigned char value_or = sbus_readb(&regs->p_or);
@@ -136,7 +136,7 @@ static unsigned char parport_sunbpp_frob_control(struct parport *p,
 						 unsigned char mask,
 						 unsigned char val)
 {
-	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
+	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->iobase;
 	unsigned char value_tcr = sbus_readb(&regs->p_tcr);
 	unsigned char value_or = sbus_readb(&regs->p_or);
 
@@ -195,7 +195,7 @@ static unsigned char parport_sunbpp_read_status(struct parport *p)
 
 static void parport_sunbpp_data_forward (struct parport *p)
 {
-	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
+	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->iobase;
 	unsigned char value_tcr = sbus_readb(&regs->p_tcr);
 
 	dprintk((KERN_DEBUG "forward\n"));
@@ -205,7 +205,7 @@ static void parport_sunbpp_data_forward (struct parport *p)
 
 static void parport_sunbpp_data_reverse (struct parport *p)
 {
-	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
+	struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->iobase;
 	u8 val = sbus_readb(&regs->p_tcr);
 
 	dprintk((KERN_DEBUG "reverse\n"));
@@ -308,13 +308,13 @@ static int bpp_probe(struct platform_device *op)
 
 	parport_sunbpp_enable_irq(p);
 
-	regs = (struct bpp_regs __iomem *)p->base;
+	regs = (struct bpp_regs __iomem *)p->iobase;
 
 	value_tcr = sbus_readb(&regs->p_tcr);
 	value_tcr &= ~P_TCR_DIR;
 	sbus_writeb(value_tcr, &regs->p_tcr);
 
-	pr_info("%s: sunbpp at 0x%lx\n", p->name, p->base);
+	pr_info("%s: sunbpp at 0x%lx\n", p->name, p->iobase);
 
 	dev_set_drvdata(&op->dev, p);
 
@@ -346,7 +346,7 @@ static void bpp_remove(struct platform_device *op)
 		free_irq(p->irq, p);
 	}
 
-	of_iounmap(&op->resource[0], (void __iomem *) p->base, p->size);
+	of_iounmap(&op->resource[0], (void __iomem *) p->iobase, p->size);
 	parport_put_port(p);
 	kfree(ops);
 
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 3f809fff317b..5505aba51c3c 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -128,7 +128,7 @@ static int do_hardware_base_addr(const struct ctl_table *table, int write,
 	if (write) /* permissions prevent this anyway */
 		return -EACCES;
 
-	len += scnprintf(buffer, sizeof(buffer), "%lu\t%lu\n", port->base, port->base_hi);
+	len += scnprintf(buffer, sizeof(buffer), "%lu\t%lu\n", port->iobase, port->iobase_hi);
 
 	if (len > *lenp)
 		len = *lenp;
diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 427abdf3c4c4..0d44d7a9c88f 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -7,8 +7,6 @@
  *          Philip Blundell <philb@gnu.org>
  *	    Andrea Arcangeli
  *
- * based on work by Grant Guenther <grant@torque.net>
- *          and Philip Blundell
  *
  * Any part of this program may be used in documents licensed under
  * the GNU Free Documentation License, Version 1.1 or any later version
@@ -435,7 +433,7 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 		return NULL;
 
 	/* Init our structure */
-	tmp->base = base;
+	tmp->iobase = base;
 	tmp->irq = irq;
 	tmp->dma = dma;
 	tmp->muxport = tmp->daisy = tmp->muxsel = -1;
@@ -931,7 +929,7 @@ struct parport *parport_find_base(unsigned long base)
 
 	spin_lock(&parportlist_lock);
 	list_for_each_entry(port, &portlist, list) {
-		if (port->base == base) {
+		if (port->iobase == base) {
 			result = parport_get_port(port);
 			break;
 		}
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 1d4c7310f1a6..e1f4c4916e18 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -69,7 +69,7 @@ static DEFINE_SPINLOCK(arbitration_lock);
 
 static void got_it(imm_struct *dev)
 {
-	dev->base = dev->dev->port->base;
+	dev->base = dev->dev->port->iobase;
 	if (dev->cur_cmd)
 		imm_scsi_pointer(dev->cur_cmd)->phase = 1;
 	else
@@ -1199,8 +1199,8 @@ static int __imm_attach(struct parport *pb)
 	}
 	dev->waiting = NULL;
 	finish_wait(&waiting, &wait);
-	dev->base = dev->dev->port->base;
-	dev->base_hi = dev->dev->port->base_hi;
+	dev->base = dev->dev->port->iobase;
+	dev->base_hi = dev->dev->port->iobase_hi;
 	w_ctr(dev->base, 0x0c);
 
 	/* Done configuration */
@@ -1225,7 +1225,7 @@ static int __imm_attach(struct parport *pb)
 	if (!host)
 		goto out1;
 	host->no_highmem = true;
-	host->io_port = pb->base;
+	host->io_port = pb->iobase;
 	host->n_io_port = ports;
 	host->dma_channel = -1;
 	host->unique_id = pb->number;
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index a06329b47851..6ce4fe9fc5d0 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -64,7 +64,7 @@ static DEFINE_SPINLOCK(arbitration_lock);
 
 static void got_it(ppa_struct *dev)
 {
-	dev->base = dev->dev->port->base;
+	dev->base = dev->dev->port->iobase;
 	if (dev->cur_cmd)
 		ppa_scsi_pointer(dev->cur_cmd)->phase = 1;
 	else
@@ -232,7 +232,7 @@ static inline void epp_reset(unsigned short ppb)
  */
 static inline void ecp_sync(ppa_struct *dev)
 {
-	int i, ppb_hi = dev->dev->port->base_hi;
+	int i, ppb_hi = dev->dev->port->iobase_hi;
 
 	if (ppb_hi == 0)
 		return;
@@ -472,7 +472,7 @@ static int ppa_init(ppa_struct *dev)
 
 	if (autodetect) {
 		int modes = dev->dev->port->modes;
-		int ppb_hi = dev->dev->port->base_hi;
+		int ppb_hi = dev->dev->port->iobase_hi;
 
 		/* Mode detection works up the chain of speed
 		 * This avoids a nasty if-then-else-if-... tree
@@ -1081,7 +1081,7 @@ static int __ppa_attach(struct parport *pb)
 	}
 	dev->waiting = NULL;
 	finish_wait(&waiting, &wait);
-	dev->base = dev->dev->port->base;
+	dev->base = dev->dev->port->iobase;
 	w_ctr(dev->base, 0x0c);
 
 	/* Done configuration */
@@ -1105,7 +1105,7 @@ static int __ppa_attach(struct parport *pb)
 	if (!host)
 		goto out1;
 	host->no_highmem = true;
-	host->io_port = pb->base;
+	host->io_port = pb->iobase;
 	host->n_io_port = ports;
 	host->dma_channel = -1;
 	host->unique_id = pb->number;
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 464c2ad28039..4e39c400d002 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -182,8 +182,8 @@ struct ieee1284_info {
 
 /* A parallel port */
 struct parport {
-	unsigned long base;	/* base address */
-	unsigned long base_hi;  /* base address (hi - ECR) */
+	unsigned long iobase;	/* base address for ioport */
+	unsigned long iobase_hi;  /* base address (hi - ECR) */
 	unsigned int size;	/* IO extent */
 	const char *name;
 	unsigned int modes;
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index f1ec5c10c3b3..4d92c831d06a 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -6,15 +6,15 @@
 
 /* --- register definitions ------------------------------- */
 
-#define ECONTROL(p) ((p)->base_hi + 0x2)
-#define CONFIGB(p)  ((p)->base_hi + 0x1)
-#define CONFIGA(p)  ((p)->base_hi + 0x0)
-#define FIFO(p)     ((p)->base_hi + 0x0)
-#define EPPDATA(p)  ((p)->base    + 0x4)
-#define EPPADDR(p)  ((p)->base    + 0x3)
-#define CONTROL(p)  ((p)->base    + 0x2)
-#define STATUS(p)   ((p)->base    + 0x1)
-#define DATA(p)     ((p)->base    + 0x0)
+#define ECONTROL(p) ((p)->iobase_hi + 0x2)
+#define CONFIGB(p)  ((p)->iobase_hi + 0x1)
+#define CONFIGA(p)  ((p)->iobase_hi + 0x0)
+#define FIFO(p)     ((p)->iobase_hi + 0x0)
+#define EPPDATA(p)  ((p)->iobase    + 0x4)
+#define EPPADDR(p)  ((p)->iobase    + 0x3)
+#define CONTROL(p)  ((p)->iobase    + 0x2)
+#define STATUS(p)   ((p)->iobase    + 0x1)
+#define DATA(p)     ((p)->iobase    + 0x0)
 
 struct parport_pc_private {
 	/* Contents of CTR. */
diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c
index 6fc255a6754d..fc6033b7118b 100644
--- a/sound/drivers/mts64.c
+++ b/sound/drivers/mts64.c
@@ -932,7 +932,7 @@ static int snd_mts64_probe(struct platform_device *pdev)
 	strcpy(card->driver, DRIVER_NAME);
 	strcpy(card->shortname, "ESI " CARD_NAME);
 	sprintf(card->longname,  "%s at 0x%lx, irq %i", 
-		card->shortname, p->base, p->irq);
+		card->shortname, p->iobase, p->irq);
 
 	mts64_cb.private = card;			 /* private */
 	pardev = parport_register_dev_model(p,		 /* port */
@@ -947,7 +947,7 @@ static int snd_mts64_probe(struct platform_device *pdev)
 
 	/* claim parport */
 	if (parport_claim(pardev)) {
-		dev_dbg(card->dev, "Cannot claim parport 0x%lx\n", pardev->port->base);
+		dev_dbg(card->dev, "Cannot claim parport 0x%lx\n", pardev->port->iobase);
 		err = -EIO;
 		goto free_pardev;
 	}
@@ -986,7 +986,7 @@ static int snd_mts64_probe(struct platform_device *pdev)
 		goto __err;
 	}
 
-	dev_info(card->dev, "ESI Miditerminal 4140 on 0x%lx\n", p->base);
+	dev_info(card->dev, "ESI Miditerminal 4140 on 0x%lx\n", p->iobase);
 	return 0;
 
 release_pardev:
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index 54d818d2f53d..1e833feb7907 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -717,7 +717,7 @@ static int snd_portman_probe(struct platform_device *pdev)
 	strcpy(card->driver, DRIVER_NAME);
 	strcpy(card->shortname, CARD_NAME);
 	sprintf(card->longname,  "%s at 0x%lx, irq %i", 
-		card->shortname, p->base, p->irq);
+		card->shortname, p->iobase, p->irq);
 
 	portman_cb.private = card;			   /* private */
 	pardev = parport_register_dev_model(p,		   /* port */
@@ -732,7 +732,7 @@ static int snd_portman_probe(struct platform_device *pdev)
 
 	/* claim parport */
 	if (parport_claim(pardev)) {
-		dev_dbg(card->dev, "Cannot claim parport 0x%lx\n", pardev->port->base);
+		dev_dbg(card->dev, "Cannot claim parport 0x%lx\n", pardev->port->iobase);
 		err = -EIO;
 		goto free_pardev;
 	}
@@ -771,7 +771,7 @@ static int snd_portman_probe(struct platform_device *pdev)
 		goto __err;
 	}
 
-	dev_info(card->dev, "Portman 2x4 on 0x%lx\n", p->base);
+	dev_info(card->dev, "Portman 2x4 on 0x%lx\n", p->iobase);
 	return 0;
 
 release_pardev:
-- 
2.25.1


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

* [PATCH 3/4] parport: add parport_data struct
  2024-10-25  8:21 [PATCH 1/4] parport: use standard kernel printing functions 412574090
  2024-10-25  8:21 ` [PATCH 2/4] parport: change struct parport member to iobase 412574090
@ 2024-10-25  8:21 ` 412574090
  2024-10-25  8:21 ` [PATCH 4/4] parport: add iomem type for parport 412574090
  2 siblings, 0 replies; 6+ messages in thread
From: 412574090 @ 2024-10-25  8:21 UTC (permalink / raw)
  To: sudipm.mukherjee; +Cc: linux-kernel, xiongxin, weiyufeng

From: weiyufeng <weiyufeng@kylinos.cn>

add parport_data struct,save iobase,iobase_hi,irq,dma for parport.

Signed-off-by: weiyufeng <weiyufeng@kylinos.cn>
---
 arch/powerpc/include/asm/parport.h  |   5 +-
 arch/sparc/include/asm/parport_64.h |  13 +--
 drivers/parisc/superio.c            |   9 ++-
 drivers/parport/parport_cs.c        |  73 ++++++++---------
 drivers/parport/parport_pc.c        | 119 +++++++++++++++++-----------
 drivers/parport/parport_serial.c    |   7 +-
 include/linux/parport.h             |   8 ++
 include/linux/parport_pc.h          |   8 +-
 8 files changed, 143 insertions(+), 99 deletions(-)

diff --git a/arch/powerpc/include/asm/parport.h b/arch/powerpc/include/asm/parport.h
index 42cc321ed754..9acfa608c531 100644
--- a/arch/powerpc/include/asm/parport.h
+++ b/arch/powerpc/include/asm/parport.h
@@ -21,6 +21,7 @@ static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
 	int propsize;
 	int count = 0;
 	int virq;
+	struct parport_data tmp_pdata;
 
 	for_each_compatible_node(np, "parallel", "pnpPNP,400") {
 		prop = of_get_property(np, "reg", &propsize);
@@ -32,8 +33,8 @@ static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
 		if (!virq)
 			continue;
 
-		if (parport_pc_probe_port(io1, io2, virq, autodma, NULL, 0)
-				!= NULL)
+		parport_data_ioport_init(&tmp_pdata, io1, io2, virq, autodma);
+		if (parport_pc_probe_port(tmp_pdata, NULL, 0) != NULL)
 			count++;
 	}
 	return count;
diff --git a/arch/sparc/include/asm/parport_64.h b/arch/sparc/include/asm/parport_64.h
index 4f530a270760..ff2b7855fbb7 100644
--- a/arch/sparc/include/asm/parport_64.h
+++ b/arch/sparc/include/asm/parport_64.h
@@ -115,13 +115,14 @@ static int ecpp_probe(struct platform_device *op)
 	unsigned long d_len;
 	struct device_node *parent;
 	struct parport *p;
+	struct parport_data tmp_pdata;
 	int slot, err;
 
 	parent = op->dev.of_node->parent;
 	if (of_node_name_eq(parent, "dma")) {
-		p = parport_pc_probe_port(base, base + 0x400,
-					  op->archdata.irqs[0], PARPORT_DMA_NOFIFO,
-					  op->dev.parent->parent, 0);
+		parport_data_ioport_init(&tmp_pdata, base, base + 0x400,
+					op->archdata.irqs[0], PARPORT_DMA_NOFIFO);
+		p = parport_pc_probe_port(tmp_pdata, op->dev.parent->parent, 0);
 		if (!p)
 			return -ENOMEM;
 		dev_set_drvdata(&op->dev, p);
@@ -169,9 +170,9 @@ static int ecpp_probe(struct platform_device *op)
 	ns87303_modify(config, PTR,
 		       0, PTR_LPT_REG_DIR);
 
-	p = parport_pc_probe_port(base, base + 0x400,
-				  op->archdata.irqs[0],
-				  slot,
+	parport_data_ioport_init(&tmp_pdata, base, base + 0x400,
+				op->archdata.irqs[0], slot);
+	p = parport_pc_probe_port(tmp_pdata,
 				  op->dev.parent,
 				  0);
 	err = -ENOMEM;
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index e973c6893203..ca162c3bbe09 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -418,10 +418,11 @@ static void __init superio_serial_init(void)
 static void __init superio_parport_init(void)
 {
 #ifdef CONFIG_PARPORT_PC
-	if (!parport_pc_probe_port(sio_dev.pp_base,
-			0 /*base_hi*/,
-			PAR_IRQ, 
-			PARPORT_DMA_NONE /* dma */,
+	struct parport_data tmp_pdata;
+
+	parport_data_ioport_init(&tmp_pdata, sio_dev.pp_base, 0,
+				PAR_IRQ, PARPORT_DMA_NONE);
+	if (!parport_pc_probe_port(tmp_pdata,
 			NULL /*struct pci_dev* */,
 			0 /* shared irq flags */))
 
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 8e7e3ac4bb87..5b2437f710cc 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -118,42 +118,43 @@ static int parport_config_check(struct pcmcia_device *p_dev, void *priv_data)
 
 static int parport_config(struct pcmcia_device *link)
 {
-    parport_info_t *info = link->priv;
-    struct parport *p;
-    int ret;
-
-    dev_dbg(&link->dev, "parport_config\n");
-
-    if (epp_mode)
-	    link->config_index |= FORCE_EPP_MODE;
-
-    ret = pcmcia_loop_config(link, parport_config_check, NULL);
-    if (ret)
-	    goto failed;
-
-    if (!link->irq)
-	    goto failed;
-    ret = pcmcia_enable_device(link);
-    if (ret)
-	    goto failed;
-
-    p = parport_pc_probe_port(link->resource[0]->start,
-			      link->resource[1]->start,
-			      link->irq, PARPORT_DMA_NONE,
-			      &link->dev, IRQF_SHARED);
-    if (p == NULL) {
-	    pr_notice("parport_cs: parport_pc_probe_port() at 0x%3x, irq %u failed\n",
-		      (unsigned int)link->resource[0]->start, link->irq);
-	goto failed;
-    }
-
-    p->modes |= PARPORT_MODE_PCSPP;
-    if (epp_mode)
-	p->modes |= PARPORT_MODE_TRISTATE | PARPORT_MODE_EPP;
-    info->ndev = 1;
-    info->port = p;
-
-    return 0;
+	parport_info_t *info = link->priv;
+	struct parport *p;
+	struct parport_data tmp_pdata;
+	int ret;
+
+	dev_dbg(&link->dev, "parport_config\n");
+
+	if (epp_mode)
+		link->config_index |= FORCE_EPP_MODE;
+
+	ret = pcmcia_loop_config(link, parport_config_check, NULL);
+	if (ret)
+		goto failed;
+
+	if (!link->irq)
+		goto failed;
+	ret = pcmcia_enable_device(link);
+	if (ret)
+		goto failed;
+
+	parport_data_ioport_init(&tmp_pdata, link->resource[0]->start,
+				link->resource[1]->start,
+				link->irq, PARPORT_DMA_NONE);
+	p = parport_pc_probe_port(tmp_pdata, &link->dev, IRQF_SHARED);
+	if (p == NULL) {
+		pr_notice("parport_cs: parport_pc_probe_port() at 0x%3x, irq %u failed\n",
+				(unsigned int)link->resource[0]->start, link->irq);
+		goto failed;
+	}
+
+	p->modes |= PARPORT_MODE_PCSPP;
+	if (epp_mode)
+		p->modes |= PARPORT_MODE_TRISTATE | PARPORT_MODE_EPP;
+	info->ndev = 1;
+	info->port = p;
+
+	return 0;
 
 failed:
 	parport_cs_release(link);
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 160d87449913..b4e959a2d8a1 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2022,9 +2022,7 @@ static int parport_dma_probe(struct parport *p)
 static LIST_HEAD(ports_list);
 static DEFINE_SPINLOCK(ports_lock);
 
-static struct parport *__parport_pc_probe_port(unsigned long int base,
-					       unsigned long int base_hi,
-					       int irq, int dma,
+static struct parport *__parport_pc_probe_port(struct parport_data data,
 					       struct device *dev,
 					       int irqflags,
 					       unsigned int mode_mask,
@@ -2044,7 +2042,7 @@ static struct parport *__parport_pc_probe_port(unsigned long int base,
 		/* We need a physical device to attach to, but none was
 		 * provided. Create our own. */
 		pdev = platform_device_register_simple("parport_pc",
-						       base, NULL, 0);
+						       data.iobase, NULL, 0);
 		if (IS_ERR(pdev))
 			return NULL;
 		dev = &pdev->dev;
@@ -2052,7 +2050,7 @@ static struct parport *__parport_pc_probe_port(unsigned long int base,
 		ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(24));
 		if (ret) {
 			dev_err(dev, "Unable to set coherent dma mask: disabling DMA\n");
-			dma = PARPORT_DMA_NONE;
+			data.dma = PARPORT_DMA_NONE;
 		}
 	}
 
@@ -2065,13 +2063,17 @@ static struct parport *__parport_pc_probe_port(unsigned long int base,
 		goto out2;
 
 	/* a misnomer, actually - it's allocate and reserve parport number */
-	p = parport_register_port(base, irq, dma, ops);
+	p = parport_register_port(data.iobase, data.irq, data.dma, ops);
 	if (!p)
 		goto out3;
 
-	base_res = request_region(base, 3, p->name);
-	if (!base_res)
+	if (p->iobase) {
+		base_res = request_region(data.iobase, 3, p->name);
+		if (!base_res)
+			goto out4;
+	} else {
 		goto out4;
+	}
 
 	memcpy(ops, &parport_pc_ops, sizeof(struct parport_operations));
 	priv->ctr = 0xc;
@@ -2085,18 +2087,18 @@ static struct parport *__parport_pc_probe_port(unsigned long int base,
 	priv->port = p;
 
 	p->dev = dev;
-	p->iobase_hi = base_hi;
+	p->iobase_hi = data.iobase_hi;
 	p->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT;
 	p->private_data = priv;
 
-	if (base_hi) {
-		ECR_res = request_region(base_hi, 3, p->name);
+	if (p->iobase_hi) {
+		ECR_res = request_region(data.iobase_hi, 3, p->name);
 		if (ECR_res)
 			parport_ECR_present(p);
 	}
 
-	if (base != 0x3bc) {
-		EPP_res = request_region(base+0x3, 5, p->name);
+	if (p->iobase != 0x3bc) {
+		EPP_res = request_region(data.iobase + 0x3, 5, p->name);
 		if (EPP_res)
 			if (!parport_EPP_supported(p))
 				parport_ECPEPP_supported(p);
@@ -2191,13 +2193,16 @@ do {									\
 		pr_info("%s: irq %d detected\n", p->name, probedirq);
 
 	/* If No ECP release the ports grabbed above. */
-	if (ECR_res && (p->modes & PARPORT_MODE_ECP) == 0) {
-		release_region(base_hi, 3);
-		ECR_res = NULL;
+	if ((p->modes & PARPORT_MODE_ECP) == 0) {
+		if (p->iobase_hi && ECR_res) {
+			release_region(p->iobase_hi, 3);
+			ECR_res = NULL;
+		}
 	}
+
 	/* Likewise for EEP ports */
-	if (EPP_res && (p->modes & PARPORT_MODE_EPP) == 0) {
-		release_region(base+3, 5);
+	if (p->iobase && EPP_res && (p->modes & PARPORT_MODE_EPP) == 0) {
+		release_region(p->iobase + 3, 5);
 		EPP_res = NULL;
 	}
 	if (p->irq != PARPORT_IRQ_NONE) {
@@ -2257,10 +2262,10 @@ do {									\
 
 out5:
 	if (ECR_res)
-		release_region(base_hi, 3);
+		release_region(p->iobase_hi, 3);
 	if (EPP_res)
-		release_region(base+0x3, 5);
-	release_region(base, 3);
+		release_region(p->iobase + 0x3, 5);
+	release_region(p->iobase, 3);
 out4:
 	parport_del_port(p);
 out3:
@@ -2273,14 +2278,24 @@ do {									\
 	return NULL;
 }
 
-struct parport *parport_pc_probe_port(unsigned long int base,
-				      unsigned long int base_hi,
-				      int irq, int dma,
+void parport_data_ioport_init(struct parport_data *tmp_pdata,
+			      unsigned long iobase,
+			      unsigned long iobase_hi,
+			      int irq, int dma)
+{
+	memset(tmp_pdata, 0, sizeof(struct parport_data));
+	tmp_pdata->iobase = iobase;
+	tmp_pdata->iobase_hi = iobase_hi;
+	tmp_pdata->irq = irq;
+	tmp_pdata->dma = dma;
+}
+EXPORT_SYMBOL(parport_data_ioport_init);
+
+struct parport *parport_pc_probe_port(struct parport_data data,
 				      struct device *dev,
 				      int irqflags)
 {
-	return __parport_pc_probe_port(base, base_hi, irq, dma,
-				       dev, irqflags, 0, 0);
+	return __parport_pc_probe_port(data, dev, irqflags, 0, 0);
 }
 EXPORT_SYMBOL(parport_pc_probe_port);
 
@@ -2325,6 +2340,7 @@ static int sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, int autodma,
 	short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 };
 	u32 ite8872set;
 	u32 ite8872_lpt, ite8872_lpthi;
+	struct parport_data tmp_pdata;
 	u8 ite8872_irq, type;
 	int irq;
 	int i;
@@ -2407,8 +2423,9 @@ static int sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, int autodma,
 	 * Release the resource so that parport_pc_probe_port can get it.
 	 */
 	release_region(inta_addr[i], 32);
-	if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi,
-				   irq, PARPORT_DMA_NONE, &pdev->dev, 0)) {
+	parport_data_ioport_init(&tmp_pdata, ite8872_lpt, ite8872_lpthi, irq,
+				PARPORT_DMA_NONE);
+	if (parport_pc_probe_port(tmp_pdata, &pdev->dev, 0)) {
 		pr_info("parport_pc: ITE 8872 parallel port: io=0x%X",
 			ite8872_lpt);
 		if (irq != PARPORT_IRQ_NONE)
@@ -2447,6 +2464,7 @@ static struct parport_pc_via_data via_8231_data = {
 static int sio_via_probe(struct pci_dev *pdev, int autoirq, int autodma,
 			 const struct parport_pc_via_data *via)
 {
+	struct parport_data tmp_pdata;
 	u8 tmp, tmp2, siofunc;
 	u8 ppcontrol = 0;
 	int dma, irq;
@@ -2587,7 +2605,8 @@ static int sio_via_probe(struct pci_dev *pdev, int autoirq, int autodma,
 	}
 
 	/* finally, do the probe with values obtained */
-	if (parport_pc_probe_port(port1, port2, irq, dma, &pdev->dev, 0)) {
+	parport_data_ioport_init(&tmp_pdata, port1, port2, irq, dma);
+	if (parport_pc_probe_port(tmp_pdata, &pdev->dev, 0)) {
 		pr_info("parport_pc: VIA parallel port: io=0x%X", port1);
 		if (irq != PARPORT_IRQ_NONE)
 			pr_cont(", irq=%d", irq);
@@ -2868,6 +2887,7 @@ static int parport_pc_pci_probe(struct pci_dev *dev,
 {
 	int err, count, n, i = id->driver_data;
 	struct pci_parport_data *data;
+	struct parport_data tmp_pdata;
 
 	if (i < last_sio)
 		/* This is an onboard Super-IO and has already been probed */
@@ -2913,9 +2933,10 @@ static int parport_pc_pci_probe(struct pci_dev *dev,
 			printk(KERN_DEBUG "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx), IRQ %d\n",
 			       id->vendor, id->device, io_lo, io_hi, irq);
 		}
+		parport_data_ioport_init(&tmp_pdata, io_lo, io_hi,
+					irq, PARPORT_DMA_NONE);
 		data->ports[count] =
-			__parport_pc_probe_port(io_lo, io_hi, irq,
-						PARPORT_DMA_NONE, &dev->dev,
+			__parport_pc_probe_port(tmp_pdata, &dev->dev,
 						IRQF_SHARED,
 						cards[i].mode_mask,
 						cards[i].ecr_writable);
@@ -3002,35 +3023,35 @@ static int parport_pc_pnp_probe(struct pnp_dev *dev,
 						const struct pnp_device_id *id)
 {
 	struct parport *pdata;
-	unsigned long io_lo, io_hi;
-	int dma, irq;
+	struct parport_data tmp_pdata;
 
+	memset(&tmp_pdata, 0, sizeof(struct parport_data));
 	if (pnp_port_valid(dev, 0) &&
 		!(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) {
-		io_lo = pnp_port_start(dev, 0);
+		tmp_pdata.iobase = pnp_port_start(dev, 0);
 	} else
 		return -EINVAL;
 
 	if (pnp_port_valid(dev, 1) &&
 		!(pnp_port_flags(dev, 1) & IORESOURCE_DISABLED)) {
-		io_hi = pnp_port_start(dev, 1);
+		tmp_pdata.iobase_hi = pnp_port_start(dev, 1);
 	} else
-		io_hi = 0;
+		tmp_pdata.iobase_hi = 0;
 
 	if (pnp_irq_valid(dev, 0) &&
 		!(pnp_irq_flags(dev, 0) & IORESOURCE_DISABLED)) {
-		irq = pnp_irq(dev, 0);
+		tmp_pdata.irq = pnp_irq(dev, 0);
 	} else
-		irq = PARPORT_IRQ_NONE;
+		tmp_pdata.irq = PARPORT_IRQ_NONE;
 
 	if (pnp_dma_valid(dev, 0) &&
 		!(pnp_dma_flags(dev, 0) & IORESOURCE_DISABLED)) {
-		dma = pnp_dma(dev, 0);
+		tmp_pdata.dma = pnp_dma(dev, 0);
 	} else
-		dma = PARPORT_DMA_NONE;
+		tmp_pdata.dma = PARPORT_DMA_NONE;
 
 	dev_info(&dev->dev, "reported by %s\n", dev->protocol->name);
-	pdata = parport_pc_probe_port(io_lo, io_hi, irq, dma, &dev->dev, 0);
+	pdata = parport_pc_probe_port(tmp_pdata, &dev->dev, 0);
 	if (pdata == NULL)
 		return -ENODEV;
 
@@ -3077,13 +3098,17 @@ static struct platform_driver parport_pc_platform_driver = {
 static int __attribute__((unused))
 parport_pc_find_isa_ports(int autoirq, int autodma)
 {
+	struct parport_data tmp_pdata;
 	int count = 0;
 
-	if (parport_pc_probe_port(0x3bc, 0x7bc, autoirq, autodma, NULL, 0))
+	parport_data_ioport_init(&tmp_pdata, 0x3bc, 0x7bc, autoirq, autodma);
+	if (parport_pc_probe_port(tmp_pdata, NULL, 0))
 		count++;
-	if (parport_pc_probe_port(0x378, 0x778, autoirq, autodma, NULL, 0))
+	parport_data_ioport_init(&tmp_pdata, 0x378, 0x778, autoirq, autodma);
+	if (parport_pc_probe_port(tmp_pdata, NULL, 0))
 		count++;
-	if (parport_pc_probe_port(0x278, 0x678, autoirq, autodma, NULL, 0))
+	parport_data_ioport_init(&tmp_pdata, 0x278, 0x678, autoirq, autodma);
+	if (parport_pc_probe_port(tmp_pdata, NULL, 0))
 		count++;
 
 	return count;
@@ -3352,6 +3377,7 @@ __setup("parport_init_mode=", parport_init_mode_setup);
 
 static int __init parport_pc_init(void)
 {
+	struct parport_data tmp_pdata;
 	int err;
 
 	if (parse_parport_params())
@@ -3370,8 +3396,9 @@ static int __init parport_pc_init(void)
 				break;
 			if (io_hi[i] == PARPORT_IOHI_AUTO)
 				io_hi[i] = 0x400 + io[i];
-			parport_pc_probe_port(io[i], io_hi[i],
-					irqval[i], dmaval[i], NULL, 0);
+			parport_data_ioport_init(&tmp_pdata, io[i], io_hi[i],
+						irqval[i], dmaval[i]);
+			parport_pc_probe_port(tmp_pdata, NULL, 0);
 		}
 	} else
 		parport_pc_find_ports(irqval[0], dmaval[0]);
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index 3644997a8342..cc6ee3f0ab3e 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -648,6 +648,7 @@ static int parport_register(struct pci_dev *dev, const struct pci_device_id *id)
 		return -ENODEV;
 
 	for (n = 0; n < card->numports; n++) {
+		struct parport_data tmp_pdata;
 		struct parport *port;
 		int lo = card->addr[n].lo;
 		int hi = card->addr[n].hi;
@@ -684,8 +685,10 @@ static int parport_register(struct pci_dev *dev, const struct pci_device_id *id)
 				"PCI parallel port detected: I/O at %#lx(%#lx), IRQ %d\n",
 				io_lo, io_hi, irq);
 		}
-		port = parport_pc_probe_port (io_lo, io_hi, irq,
-			      PARPORT_DMA_NONE, &dev->dev, IRQF_SHARED);
+		parport_data_ioport_init(&tmp_pdata, io_lo, io_hi,
+					irq, PARPORT_DMA_NONE);
+		port = parport_pc_probe_port(tmp_pdata, &dev->dev,
+						IRQF_SHARED);
 		if (port) {
 			priv->port[priv->num_par++] = port;
 			success = 1;
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 4e39c400d002..308eadce42dd 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -180,6 +180,14 @@ struct ieee1284_info {
 	struct semaphore irq;
 };
 
+struct parport_data {
+	/* for ioport */
+	unsigned long iobase;   /* base address for ioport */
+	unsigned long iobase_hi;        /* base address (hi - ECR) */
+	int irq;
+	int dma;
+};
+
 /* A parallel port */
 struct parport {
 	unsigned long iobase;	/* base address for ioport */
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index 4d92c831d06a..d6c3f323caa1 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -230,11 +230,13 @@ static __inline__ void parport_pc_enable_irq(struct parport *p)
 extern void parport_pc_release_resources(struct parport *p);
 
 extern int parport_pc_claim_resources(struct parport *p);
+extern void parport_data_ioport_init(struct parport_data *tmp_pdata,
+				     unsigned long iobase,
+				     unsigned long iobase_hi,
+				     int irq, int dma);
 
 /* PCMCIA code will want to get us to look at a port.  Provide a mechanism. */
-extern struct parport *parport_pc_probe_port(unsigned long base,
-					     unsigned long base_hi,
-					     int irq, int dma,
+extern struct parport *parport_pc_probe_port(struct parport_data data,
 					     struct device *dev,
 					     int irqflags);
 extern void parport_pc_unregister_port(struct parport *p);
-- 
2.25.1


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

* [PATCH 4/4] parport: add iomem type for parport
  2024-10-25  8:21 [PATCH 1/4] parport: use standard kernel printing functions 412574090
  2024-10-25  8:21 ` [PATCH 2/4] parport: change struct parport member to iobase 412574090
  2024-10-25  8:21 ` [PATCH 3/4] parport: add parport_data struct 412574090
@ 2024-10-25  8:21 ` 412574090
  2 siblings, 0 replies; 6+ messages in thread
From: 412574090 @ 2024-10-25  8:21 UTC (permalink / raw)
  To: sudipm.mukherjee; +Cc: linux-kernel, xiongxin, weiyufeng

From: weiyufeng <weiyufeng@kylinos.cn>

Solve the problem of not being able to use LPC and PCIE parallel
ports simultaneously on the phytium platform.Optimize lpc and
pci parallel port program. add iomem type for parport.
In DSDT,LPT recommends the following description:
Device (LPT)
{
    Name (_HID, EisaId ("PNP0400") /* Standard LPT Parallel Port */)
    Name (_UID, Zero)  // _UID: Unique ID
    Name (_DDN, "LPT1")  // _DDN: DOS Device Name
    Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
    {
      Memory32Fixed (ReadWrite,
          0x20000378,  // Address Base
          0x00000008,  // Address Length
          )
          IRQNoFlags ()
             {7}
    })
}

Signed-off-by: weiyufeng <weiyufeng@kylinos.cn>
---
 drivers/parport/parport_pc.c | 542 +++++++++++++++++++++--------------
 include/linux/parport.h      |  18 ++
 include/linux/parport_pc.h   | 101 +++++--
 3 files changed, 420 insertions(+), 241 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index b4e959a2d8a1..851b984c8a78 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -112,7 +112,7 @@ static void frob_econtrol(struct parport *pb, unsigned char m,
 	unsigned char new;
 
 	if (m != 0xff)
-		ectr = inb(ECONTROL(pb));
+		ectr = parport_pc_readb(pb, ECONTROL(pb));
 
 	new = (ectr & ~m) ^ v;
 	if (ecr_writable)
@@ -121,7 +121,7 @@ static void frob_econtrol(struct parport *pb, unsigned char m,
 
 	pr_debug("frob_econtrol(%02x,%02x): %02x -> %02x\n", m, v, ectr, new);
 
-	outb(new, ECONTROL(pb));
+	parport_pc_writeb(pb, new, ECONTROL(pb));
 }
 
 static inline void frob_set_mode(struct parport *p, int mode)
@@ -150,7 +150,7 @@ static int change_mode(struct parport *p, int m)
 	}
 
 	/* Bits <7:5> contain the mode. */
-	oecr = inb(ECONTROL(p));
+	oecr = parport_pc_readb(p, ECONTROL(p));
 	mode = (oecr >> 5) & 0x7;
 	if (mode == m)
 		return 0;
@@ -165,7 +165,7 @@ static int change_mode(struct parport *p, int m)
 		case ECR_ECP: /* ECP Parallel Port mode */
 			/* Busy wait for 200us */
 			for (counter = 0; counter < 40; counter++) {
-				if (inb(ECONTROL(p)) & 0x01)
+				if (parport_pc_readb(p, ECONTROL(p)) & 0x01)
 					break;
 				if (signal_pending(current))
 					break;
@@ -173,7 +173,7 @@ static int change_mode(struct parport *p, int m)
 			}
 
 			/* Poll slowly. */
-			while (!(inb(ECONTROL(p)) & 0x01)) {
+			while (!(parport_pc_readb(p, ECONTROL(p)) & 0x01)) {
 				if (time_after_eq(jiffies, expire))
 					/* The FIFO is stuck. */
 					return -EBUSY;
@@ -215,8 +215,9 @@ static int clear_epp_timeout(struct parport *pb)
 	/* To clear timeout some chips require double read */
 	parport_pc_read_status(pb);
 	r = parport_pc_read_status(pb);
-	outb(r | 0x01, STATUS(pb)); /* Some reset by writing 1 */
-	outb(r & 0xfe, STATUS(pb)); /* Others by writing 0 */
+	parport_pc_writeb(pb, r | 0x01,
+				STATUS(pb)); /* Some reset by writing 1 */
+	parport_pc_writeb(pb, r & 0xfe, STATUS(pb)); /* Others by writing 0 */
 	r = parport_pc_read_status(pb);
 
 	return !(r & 0x01);
@@ -248,7 +249,7 @@ static void parport_pc_save_state(struct parport *p, struct parport_state *s)
 	const struct parport_pc_private *priv = p->physport->private_data;
 	s->u.pc.ctr = priv->ctr;
 	if (priv->ecr)
-		s->u.pc.ecr = inb(ECONTROL(p));
+		s->u.pc.ecr = parport_pc_readb(p, ECONTROL(p));
 }
 
 static void parport_pc_restore_state(struct parport *p,
@@ -256,7 +257,7 @@ static void parport_pc_restore_state(struct parport *p,
 {
 	struct parport_pc_private *priv = p->physport->private_data;
 	register unsigned char c = s->u.pc.ctr & priv->ctr_writable;
-	outb(c, CONTROL(p));
+	parport_pc_writeb(p, c, CONTROL(p));
 	priv->ctr = c;
 	if (priv->ecr)
 		ECR_WRITE(p, s->u.pc.ecr);
@@ -276,26 +277,29 @@ static size_t parport_pc_epp_read_data(struct parport *port, void *buf,
 		 *  nFault is 0 if there is at least 1 byte in the Warp's FIFO
 		 *  pError is 1 if there are 16 bytes in the Warp's FIFO
 		 */
-		status = inb(STATUS(port));
+		status = parport_pc_readb(port, STATUS(port));
 
 		while (!(status & 0x08) && got < length) {
 			if (left >= 16 && (status & 0x20) && !(status & 0x08)) {
 				/* can grab 16 bytes from warp fifo */
 				if (!((long)buf & 0x03))
-					insl(EPPDATA(port), buf, 4);
+					parport_pc_readsl(port, EPPDATA(port),
+							buf, 4);
 				else
-					insb(EPPDATA(port), buf, 16);
+					parport_pc_readsb(port, EPPDATA(port),
+							buf, 16);
 				buf += 16;
 				got += 16;
 				left -= 16;
 			} else {
 				/* grab single byte from the warp fifo */
-				*((char *)buf) = inb(EPPDATA(port));
+				*((char *)buf) = parport_pc_readb(port,
+						EPPDATA(port));
 				buf++;
 				got++;
 				left--;
 			}
-			status = inb(STATUS(port));
+			status = parport_pc_readb(port, STATUS(port));
 			if (status & 0x01) {
 				/* EPP timeout should never occur... */
 				printk(KERN_DEBUG "%s: EPP timeout occurred while talking to w91284pic (should not have done)\n",
@@ -310,22 +314,24 @@ static size_t parport_pc_epp_read_data(struct parport *port, void *buf,
 			   || flags & PARPORT_EPP_FAST_8)) {
 		if ((flags & PARPORT_EPP_FAST_32)
 		    && !(((long)buf | length) & 0x03))
-			insl(EPPDATA(port), buf, (length >> 2));
+			parport_pc_readsl(port, EPPDATA(port), buf,
+					(length >> 2));
 		else if ((flags & PARPORT_EPP_FAST_16)
 			 && !(((long)buf | length) & 0x01))
-			insw(EPPDATA(port), buf, length >> 1);
+			parport_pc_readsw(port, EPPDATA(port), buf,
+					length >> 1);
 		else
-			insb(EPPDATA(port), buf, length);
-		if (inb(STATUS(port)) & 0x01) {
+			parport_pc_readsb(port, EPPDATA(port), buf, length);
+		if (parport_pc_readb(port, STATUS(port)) & 0x01) {
 			clear_epp_timeout(port);
 			return -EIO;
 		}
 		return length;
 	}
 	for (; got < length; got++) {
-		*((char *)buf) = inb(EPPDATA(port));
+		*((char *)buf) = parport_pc_readb(port, EPPDATA(port));
 		buf++;
-		if (inb(STATUS(port)) & 0x01) {
+		if (parport_pc_readb(port, STATUS(port)) & 0x01) {
 			/* EPP timeout */
 			clear_epp_timeout(port);
 			break;
@@ -345,22 +351,24 @@ static size_t parport_pc_epp_write_data(struct parport *port, const void *buf,
 			   || flags & PARPORT_EPP_FAST_8)) {
 		if ((flags & PARPORT_EPP_FAST_32)
 		    && !(((long)buf | length) & 0x03))
-			outsl(EPPDATA(port), buf, (length >> 2));
+			parport_pc_writesl(port, EPPDATA(port), buf,
+					(length >> 2));
 		else if ((flags & PARPORT_EPP_FAST_16)
 			 && !(((long)buf | length) & 0x01))
-			outsw(EPPDATA(port), buf, length >> 1);
+			parport_pc_writesw(port, EPPDATA(port), buf,
+					length >> 1);
 		else
-			outsb(EPPDATA(port), buf, length);
-		if (inb(STATUS(port)) & 0x01) {
+			parport_pc_writesb(port, EPPDATA(port), buf, length);
+		if (parport_pc_readb(port, STATUS(port)) & 0x01) {
 			clear_epp_timeout(port);
 			return -EIO;
 		}
 		return length;
 	}
 	for (; written < length; written++) {
-		outb(*((char *)buf), EPPDATA(port));
+		parport_pc_writeb(port, *((char *)buf), EPPDATA(port));
 		buf++;
-		if (inb(STATUS(port)) & 0x01) {
+		if (parport_pc_readb(port, STATUS(port)) & 0x01) {
 			clear_epp_timeout(port);
 			break;
 		}
@@ -375,17 +383,17 @@ static size_t parport_pc_epp_read_addr(struct parport *port, void *buf,
 	size_t got = 0;
 
 	if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
-		insb(EPPADDR(port), buf, length);
-		if (inb(STATUS(port)) & 0x01) {
+		parport_pc_readsb(port, EPPADDR(port), buf, length);
+		if (parport_pc_readb(port, STATUS(port)) & 0x01) {
 			clear_epp_timeout(port);
 			return -EIO;
 		}
 		return length;
 	}
 	for (; got < length; got++) {
-		*((char *)buf) = inb(EPPADDR(port));
+		*((char *)buf) = parport_pc_readb(port, EPPADDR(port));
 		buf++;
-		if (inb(STATUS(port)) & 0x01) {
+		if (parport_pc_readb(port, STATUS(port)) & 0x01) {
 			clear_epp_timeout(port);
 			break;
 		}
@@ -401,17 +409,17 @@ static size_t parport_pc_epp_write_addr(struct parport *port,
 	size_t written = 0;
 
 	if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
-		outsb(EPPADDR(port), buf, length);
-		if (inb(STATUS(port)) & 0x01) {
+		parport_pc_writesb(port, EPPADDR(port), buf, length);
+		if (parport_pc_readb(port, STATUS(port)) & 0x01) {
 			clear_epp_timeout(port);
 			return -EIO;
 		}
 		return length;
 	}
 	for (; written < length; written++) {
-		outb(*((char *)buf), EPPADDR(port));
+		parport_pc_writeb(port, *((char *)buf), EPPADDR(port));
 		buf++;
-		if (inb(STATUS(port)) & 0x01) {
+		if (parport_pc_readb(port, STATUS(port)) & 0x01) {
 			clear_epp_timeout(port);
 			break;
 		}
@@ -504,7 +512,7 @@ static size_t parport_pc_fifo_write_block_pio(struct parport *port,
 
 	while (left) {
 		unsigned char byte;
-		unsigned char ecrval = inb(ECONTROL(port));
+		unsigned char ecrval = parport_pc_readb(port, ECONTROL(port));
 		int i = 0;
 
 		if (need_resched() && time_before(jiffies, expire))
@@ -532,7 +540,7 @@ static size_t parport_pc_fifo_write_block_pio(struct parport *port,
 				printk(KERN_DEBUG "FIFO write timed out\n");
 				break;
 			}
-			ecrval = inb(ECONTROL(port));
+			ecrval = parport_pc_readb(port, ECONTROL(port));
 			if (!(ecrval & (1<<2))) {
 				if (need_resched() &&
 				    time_before(jiffies, expire))
@@ -554,7 +562,7 @@ static size_t parport_pc_fifo_write_block_pio(struct parport *port,
 		if (ecrval & 0x01) {
 			/* FIFO is empty. Blast it full. */
 			const int n = left < fifo_depth ? left : fifo_depth;
-			outsb(fifo, bufp, n);
+			parport_pc_writesb(port, fifo, bufp, n);
 			bufp += n;
 			left -= n;
 
@@ -564,13 +572,13 @@ static size_t parport_pc_fifo_write_block_pio(struct parport *port,
 			continue;
 		} else if (i++ < poll_for) {
 			udelay(10);
-			ecrval = inb(ECONTROL(port));
+			ecrval = parport_pc_readb(port, ECONTROL(port));
 			goto poll;
 		}
 
 		/* Half-full(call me an optimist) */
 		byte = *bufp++;
-		outb(byte, fifo);
+		parport_pc_writeb(port, byte, fifo);
 		left--;
 	}
 	dump_parport_state("leave fifo_write_block_pio", port);
@@ -662,7 +670,7 @@ static size_t parport_pc_fifo_write_block_dma(struct parport *port,
 			break;
 		}
 		/* Is serviceIntr set? */
-		if (!(inb(ECONTROL(port)) & (1<<2))) {
+		if (!(parport_pc_readb(port, ECONTROL(port)) & (1<<2))) {
 			cond_resched();
 
 			goto false_alarm;
@@ -767,11 +775,11 @@ static size_t parport_pc_compat_write_block_pio(struct parport *port,
 
 		/* Adjust for the contents of the FIFO. */
 		for (written -= priv->fifo_depth; ; written++) {
-			if (inb(ECONTROL(port)) & 0x2) {
+			if (parport_pc_readb(port, ECONTROL(port)) & 0x2) {
 				/* Full up. */
 				break;
 			}
-			outb(0, FIFO(port));
+			parport_pc_writeb(port, 0, FIFO(port));
 		}
 
 		/* Reset the FIFO and return to PS2 mode. */
@@ -862,11 +870,11 @@ static size_t parport_pc_ecp_write_block_pio(struct parport *port,
 
 		/* Adjust for the contents of the FIFO. */
 		for (written -= priv->fifo_depth; ; written++) {
-			if (inb(ECONTROL(port)) & 0x2) {
+			if (parport_pc_readb(port, ECONTROL(port)) & 0x2) {
 				/* Full up. */
 				break;
 			}
-			outb(0, FIFO(port));
+			parport_pc_writeb(port, 0, FIFO(port));
 		}
 
 		/* Reset the FIFO and return to PS2 mode. */
@@ -975,21 +983,21 @@ static void show_parconfig_smsc37c669(int io, int key)
 		"ECP",
 		"ECP and EPP" };
 
-	outb(key, io);
-	outb(key, io);
-	outb(1, io);
-	cr1 = inb(io + 1);
-	outb(4, io);
-	cr4 = inb(io + 1);
-	outb(0x0a, io);
-	cra = inb(io + 1);
-	outb(0x23, io);
-	cr23 = inb(io + 1);
-	outb(0x26, io);
-	cr26 = inb(io + 1);
-	outb(0x27, io);
-	cr27 = inb(io + 1);
-	outb(0xaa, io);
+	parport_pc_writeb(NULL, key, io);
+	parport_pc_writeb(NULL, key, io);
+	parport_pc_writeb(NULL, 1, io);
+	cr1 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 4, io);
+	cr4 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x0a, io);
+	cra = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x23, io);
+	cr23 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x26, io);
+	cr26 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x27, io);
+	cr27 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0xaa, io);
 
 	if (verbose_probing) {
 		pr_info("SMSC 37c669 LPT Config: cr_1=0x%02x, 4=0x%02x, A=0x%2x, 23=0x%02x, 26=0x%02x, 27=0x%02x\n",
@@ -1065,23 +1073,25 @@ static void show_parconfig_winbond(int io, int key)
 	/* The registers are called compatible-PnP because the
 	   register layout is modelled after ISA-PnP, the access
 	   method is just another ... */
-	outb(key, io);
-	outb(key, io);
-	outb(0x07, io);   /* Register 7: Select Logical Device */
-	outb(0x01, io + 1); /* LD1 is Parallel Port */
-	outb(0x30, io);
-	cr30 = inb(io + 1);
-	outb(0x60, io);
-	cr60 = inb(io + 1);
-	outb(0x61, io);
-	cr61 = inb(io + 1);
-	outb(0x70, io);
-	cr70 = inb(io + 1);
-	outb(0x74, io);
-	cr74 = inb(io + 1);
-	outb(0xf0, io);
-	crf0 = inb(io + 1);
-	outb(0xaa, io);
+	parport_pc_writeb(NULL, key, io);
+	parport_pc_writeb(NULL, key, io);
+	parport_pc_writeb(NULL, 0x07, io); /* Register 7:
+					    * Select Logical Device
+					    */
+	parport_pc_writeb(NULL, 0x01, io + 1); /* LD1 is Parallel Port */
+	parport_pc_writeb(NULL, 0x30, io);
+	cr30 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x60, io);
+	cr60 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x61, io);
+	cr61 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x70, io);
+	cr70 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x74, io);
+	cr74 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0xf0, io);
+	crf0 = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0xaa, io);
 
 	if (verbose_probing) {
 		pr_info("Winbond LPT Config: cr_30=%02x 60,61=%02x%02x 70=%02x 74=%02x, f0=%02x\n",
@@ -1202,28 +1212,36 @@ static void winbond_check(int io, int key)
 	if (!request_region(io, 3, __func__))
 		return;
 
-	origval = inb(io); /* Save original value */
+	origval = parport_pc_readb(NULL, io); /* Save original value */
 
 	/* First probe without key */
-	outb(0x20, io);
-	x_devid = inb(io + 1);
-	outb(0x21, io);
-	x_devrev = inb(io + 1);
-	outb(0x09, io);
-	x_oldid = inb(io + 1);
-
-	outb(key, io);
-	outb(key, io);     /* Write Magic Sequence to EFER, extended
-			      function enable register */
-	outb(0x20, io);    /* Write EFIR, extended function index register */
-	devid = inb(io + 1);  /* Read EFDR, extended function data register */
-	outb(0x21, io);
-	devrev = inb(io + 1);
-	outb(0x09, io);
-	oldid = inb(io + 1);
-	outb(0xaa, io);    /* Magic Seal */
-
-	outb(origval, io); /* in case we poked some entirely different hardware */
+	parport_pc_writeb(NULL, 0x20, io);
+	x_devid = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x21, io);
+	x_devrev = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x09, io);
+	x_oldid = parport_pc_readb(NULL, io + 1);
+
+	parport_pc_writeb(NULL, key, io);
+	parport_pc_writeb(NULL, key, io);     /* Write Magic Sequence to EFER,
+					       * extended function
+					       * enable register
+					       */
+	parport_pc_writeb(NULL, 0x20, io);    /* Write EFIR, extended function
+					       * index register
+					       */
+	devid = parport_pc_readb(NULL, io + 1);  /* Read EFDR, extended
+						  * function data register
+						  */
+	parport_pc_writeb(NULL, 0x21, io);
+	devrev = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x09, io);
+	oldid = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0xaa, io);    /* Magic Seal */
+
+	parport_pc_writeb(NULL, origval, io); /* in case we poked some
+					       * entirely different hardware
+					       */
 
 	if ((x_devid == devid) && (x_devrev == devrev) && (x_oldid == oldid))
 		goto out; /* protection against false positives */
@@ -1240,31 +1258,38 @@ static void winbond_check2(int io, int key)
 	if (!request_region(io, 3, __func__))
 		return;
 
-	origval[0] = inb(io); /* Save original values */
-	origval[1] = inb(io + 1);
-	origval[2] = inb(io + 2);
+	origval[0] = parport_pc_readb(NULL, io); /* Save original values */
+	origval[1] = parport_pc_readb(NULL, io + 1);
+	origval[2] = parport_pc_readb(NULL, io + 2);
 
 	/* First probe without the key */
-	outb(0x20, io + 2);
-	x_devid = inb(io + 2);
-	outb(0x21, io + 1);
-	x_devrev = inb(io + 2);
-	outb(0x09, io + 1);
-	x_oldid = inb(io + 2);
-
-	outb(key, io);     /* Write Magic Byte to EFER, extended
-			      function enable register */
-	outb(0x20, io + 2);  /* Write EFIR, extended function index register */
-	devid = inb(io + 2);  /* Read EFDR, extended function data register */
-	outb(0x21, io + 1);
-	devrev = inb(io + 2);
-	outb(0x09, io + 1);
-	oldid = inb(io + 2);
-	outb(0xaa, io);    /* Magic Seal */
-
-	outb(origval[0], io); /* in case we poked some entirely different hardware */
-	outb(origval[1], io + 1);
-	outb(origval[2], io + 2);
+	parport_pc_writeb(NULL, 0x20, io + 2);
+	x_devid = parport_pc_readb(NULL, io + 2);
+	parport_pc_writeb(NULL, 0x21, io + 1);
+	x_devrev = parport_pc_readb(NULL, io + 2);
+	parport_pc_writeb(NULL, 0x09, io + 1);
+	x_oldid = parport_pc_readb(NULL, io + 2);
+
+	parport_pc_writeb(NULL, key, io); /* Write Magic Byte to EFER, extended
+					   * function enable register
+					   */
+	parport_pc_writeb(NULL, 0x20, io + 2); /* Write EFIR, extended function
+						*  index register
+						*/
+	devid = parport_pc_readb(NULL, io + 2);  /* Read EFDR, extended
+						  * function data register
+						  */
+	parport_pc_writeb(NULL, 0x21, io + 1);
+	devrev = parport_pc_readb(NULL, io + 2);
+	parport_pc_writeb(NULL, 0x09, io + 1);
+	oldid = parport_pc_readb(NULL, io + 2);
+	parport_pc_writeb(NULL, 0xaa, io);    /* Magic Seal */
+
+	parport_pc_writeb(NULL, origval[0], io); /* in case we poked some
+						  * entirely different hardware
+						  */
+	parport_pc_writeb(NULL, origval[1], io + 1);
+	parport_pc_writeb(NULL, origval[2], io + 2);
 
 	if (x_devid == devid && x_devrev == devrev && x_oldid == oldid)
 		goto out; /* protection against false positives */
@@ -1281,32 +1306,40 @@ static void smsc_check(int io, int key)
 	if (!request_region(io, 3, __func__))
 		return;
 
-	origval = inb(io); /* Save original value */
+	origval = parport_pc_readb(NULL, io); /* Save original value */
 
 	/* First probe without the key */
-	outb(0x0d, io);
-	x_oldid = inb(io + 1);
-	outb(0x0e, io);
-	x_oldrev = inb(io + 1);
-	outb(0x20, io);
-	x_id = inb(io + 1);
-	outb(0x21, io);
-	x_rev = inb(io + 1);
-
-	outb(key, io);
-	outb(key, io);     /* Write Magic Sequence to EFER, extended
-			      function enable register */
-	outb(0x0d, io);    /* Write EFIR, extended function index register */
-	oldid = inb(io + 1);  /* Read EFDR, extended function data register */
-	outb(0x0e, io);
-	oldrev = inb(io + 1);
-	outb(0x20, io);
-	id = inb(io + 1);
-	outb(0x21, io);
-	rev = inb(io + 1);
-	outb(0xaa, io);    /* Magic Seal */
-
-	outb(origval, io); /* in case we poked some entirely different hardware */
+	parport_pc_writeb(NULL, 0x0d, io);
+	x_oldid = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x0e, io);
+	x_oldrev = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x20, io);
+	x_id = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x21, io);
+	x_rev = parport_pc_readb(NULL, io + 1);
+
+	parport_pc_writeb(NULL, key, io);
+	parport_pc_writeb(NULL, key, io); /* Write Magic Sequence to EFER,
+					   * extended function
+					   * enable register
+					   */
+	parport_pc_writeb(NULL, 0x0d, io);  /* Write EFIR, extended function
+					     * index register
+					     */
+	oldid = parport_pc_readb(NULL, io + 1);  /* Read EFDR, extended
+						  * function data register
+						  */
+	parport_pc_writeb(NULL, 0x0e, io);
+	oldrev = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x20, io);
+	id = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0x21, io);
+	rev = parport_pc_readb(NULL, io + 1);
+	parport_pc_writeb(NULL, 0xaa, io);    /* Magic Seal */
+
+	parport_pc_writeb(NULL, origval, io); /* in case we poked some entirely
+					       * different hardware
+					       */
 
 	if (x_id == id && x_oldrev == oldrev &&
 	    x_oldid == oldid && x_rev == rev)
@@ -1349,28 +1382,28 @@ static void detect_and_report_it87(void)
 		printk(KERN_DEBUG "IT8705 Super-IO detection, now testing port 2E ...\n");
 	if (!request_muxed_region(0x2e, 2, __func__))
 		return;
-	origval = inb(0x2e);		/* Save original value */
-	outb(0x87, 0x2e);
-	outb(0x01, 0x2e);
-	outb(0x55, 0x2e);
-	outb(0x55, 0x2e);
-	outb(0x20, 0x2e);
-	dev = inb(0x2f) << 8;
-	outb(0x21, 0x2e);
-	dev |= inb(0x2f);
+	origval = parport_pc_readb(NULL, 0x2e); /* Save original value */
+	parport_pc_writeb(NULL, 0x87, 0x2e);
+	parport_pc_writeb(NULL, 0x01, 0x2e);
+	parport_pc_writeb(NULL, 0x55, 0x2e);
+	parport_pc_writeb(NULL, 0x55, 0x2e);
+	parport_pc_writeb(NULL, 0x20, 0x2e);
+	dev = parport_pc_readb(NULL, 0x2f) << 8;
+	parport_pc_writeb(NULL, 0x21, 0x2e);
+	dev |= parport_pc_readb(NULL, 0x2f);
 	if (dev == 0x8712 || dev == 0x8705 || dev == 0x8715 ||
 	    dev == 0x8716 || dev == 0x8718 || dev == 0x8726) {
 		pr_info("IT%04X SuperIO detected\n", dev);
-		outb(0x07, 0x2E);	/* Parallel Port */
-		outb(0x03, 0x2F);
-		outb(0xF0, 0x2E);	/* BOOT 0x80 off */
-		r = inb(0x2f);
-		outb(0xF0, 0x2E);
-		outb(r | 8, 0x2F);
-		outb(0x02, 0x2E);	/* Lock */
-		outb(0x02, 0x2F);
+		parport_pc_writeb(NULL, 0x07, 0x2E);    /* Parallel Port */
+		parport_pc_writeb(NULL, 0x03, 0x2F);
+		parport_pc_writeb(NULL, 0xF0, 0x2E);    /* BOOT 0x80 off */
+		r = parport_pc_readb(NULL, 0x2f);
+		parport_pc_writeb(NULL, 0xF0, 0x2E);
+		parport_pc_writeb(NULL, r | 8, 0x2F);
+		parport_pc_writeb(NULL, 0x02, 0x2E);    /* Lock */
+		parport_pc_writeb(NULL, 0x02, 0x2F);
 	} else {
-		outb(origval, 0x2e);	/* Oops, sorry to disturb */
+		parport_pc_writeb(NULL, origval, 0x2e);
 	}
 	release_region(0x2e, 2);
 }
@@ -1427,19 +1460,19 @@ static int parport_SPP_supported(struct parport *pb)
 
 	/* Do a simple read-write test to make sure the port exists. */
 	w = 0xc;
-	outb(w, CONTROL(pb));
+	parport_pc_writeb(pb, w, CONTROL(pb));
 
 	/* Is there a control register that we can read from?  Some
 	 * ports don't allow reads, so read_control just returns a
 	 * software copy. Some ports _do_ allow reads, so bypass the
 	 * software copy here.  In addition, some bits aren't
 	 * writable. */
-	r = inb(CONTROL(pb));
+	r = parport_pc_readb(pb, CONTROL(pb));
 	if ((r & 0xf) == w) {
 		w = 0xe;
-		outb(w, CONTROL(pb));
-		r = inb(CONTROL(pb));
-		outb(0xc, CONTROL(pb));
+		parport_pc_writeb(pb, w, CONTROL(pb));
+		r = parport_pc_readb(pb, CONTROL(pb));
+		parport_pc_writeb(pb, 0xc, CONTROL(pb));
 		if ((r & 0xf) == w)
 			return PARPORT_MODE_PCSPP;
 	}
@@ -1499,26 +1532,26 @@ static int parport_ECR_present(struct parport *pb)
 	unsigned char r = 0xc;
 
 	if (!priv->ecr_writable) {
-		outb(r, CONTROL(pb));
-		if ((inb(ECONTROL(pb)) & 0x3) == (r & 0x3)) {
-			outb(r ^ 0x2, CONTROL(pb)); /* Toggle bit 1 */
+		parport_pc_writeb(pb, r, CONTROL(pb));
+		if ((parport_pc_readb(pb, ECONTROL(pb)) & 0x3) == (r & 0x3)) {
+			parport_pc_writeb(pb, r ^ 0x2, CONTROL(pb)); /* Toggle bit 1 */
 
-			r = inb(CONTROL(pb));
-			if ((inb(ECONTROL(pb)) & 0x2) == (r & 0x2))
+			r = parport_pc_readb(pb, CONTROL(pb));
+			if ((parport_pc_readb(pb, ECONTROL(pb)) & 0x2) == (r & 0x2))
 				/* Sure that no ECR register exists */
 				goto no_reg;
 		}
 
-		if ((inb(ECONTROL(pb)) & 0x3) != 0x1)
+		if ((parport_pc_readb(pb, ECONTROL(pb)) & 0x3) != 0x1)
 			goto no_reg;
 
 		ECR_WRITE(pb, 0x34);
-		if (inb(ECONTROL(pb)) != 0x35)
+		if (parport_pc_readb(pb, ECONTROL(pb)) != 0x35)
 			goto no_reg;
 	}
 
 	priv->ecr = 1;
-	outb(0xc, CONTROL(pb));
+	parport_pc_writeb(pb, 0xc, CONTROL(pb));
 
 	/* Go to mode 000 */
 	frob_set_mode(pb, ECR_SPP);
@@ -1526,7 +1559,7 @@ static int parport_ECR_present(struct parport *pb)
 	return 1;
 
  no_reg:
-	outb(0xc, CONTROL(pb));
+	parport_pc_writeb(pb, 0xc, CONTROL(pb));
 	return 0;
 }
 
@@ -1595,8 +1628,9 @@ static int parport_ECP_supported(struct parport *pb)
 	/* Find out FIFO depth */
 	ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */
 	ECR_WRITE(pb, ECR_TST << 5); /* TEST FIFO */
-	for (i = 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02); i++)
-		outb(0xaa, FIFO(pb));
+	for (i = 0; i < 1024 && !(parport_pc_readb(pb, ECONTROL(pb))
+		& 0x02); i++)
+		parport_pc_writeb(pb, 0xaa, FIFO(pb));
 
 	/*
 	 * Using LGS chipset it uses ECR register, but
@@ -1615,9 +1649,9 @@ static int parport_ECP_supported(struct parport *pb)
 	frob_econtrol(pb, 1<<2, 1<<2);
 	frob_econtrol(pb, 1<<2, 0);
 	for (i = 1; i <= priv->fifo_depth; i++) {
-		inb(FIFO(pb));
+		parport_pc_readb(pb, FIFO(pb));
 		udelay(50);
-		if (inb(ECONTROL(pb)) & (1<<2))
+		if (parport_pc_readb(pb, ECONTROL(pb)) & (1<<2))
 			break;
 	}
 
@@ -1639,8 +1673,8 @@ static int parport_ECP_supported(struct parport *pb)
 	frob_econtrol(pb, 1<<2, 1<<2);
 	frob_econtrol(pb, 1<<2, 0);
 	for (i = 1; i <= priv->fifo_depth; i++) {
-		outb(0xaa, FIFO(pb));
-		if (inb(ECONTROL(pb)) & (1<<2))
+		parport_pc_writeb(pb, 0xaa, FIFO(pb));
+		if (parport_pc_readb(pb, ECONTROL(pb)) & (1<<2))
 			break;
 	}
 
@@ -1656,7 +1690,7 @@ static int parport_ECP_supported(struct parport *pb)
 
 	ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */
 	ECR_WRITE(pb, 0xf4); /* Configuration mode */
-	config = inb(CONFIGA(pb));
+	config = parport_pc_readb(pb, CONFIGA(pb));
 	pword = (config >> 4) & 0x7;
 	switch (pword) {
 	case 0:
@@ -1682,7 +1716,7 @@ static int parport_ECP_supported(struct parport *pb)
 		pr_debug("0x%lx: Interrupts are ISA-%s\n",
 		       pb->iobase, config & 0x80 ? "Level" : "Pulses");
 
-		configb = inb(CONFIGB(pb));
+		configb = parport_pc_readb(pb, CONFIGB(pb));
 		pr_debug("0x%lx: ECP port cfgA=0x%02x cfgB=0x%02x\n",
 		       pb->iobase, config, configb);
 		pr_debug("0x%lx: ECP settings irq=", pb->iobase);
@@ -1712,7 +1746,7 @@ static int intel_bug_present_check_epp(struct parport *pb)
 
 	if (priv->ecr) {
 		/* store value of ECR */
-		unsigned char ecr = inb(ECONTROL(pb));
+		unsigned char ecr = parport_pc_readb(pb, ECONTROL(pb));
 		unsigned char i;
 		for (i = 0x00; i < 0x80; i += 0x20) {
 			ECR_WRITE(pb, i);
@@ -1753,7 +1787,7 @@ static int parport_ECPPS2_supported(struct parport *pb)
 	if (!priv->ecr)
 		return 0;
 
-	oecr = inb(ECONTROL(pb));
+	oecr = parport_pc_readb(pb, ECONTROL(pb));
 	ECR_WRITE(pb, ECR_PS2 << 5);
 	result = parport_PS2_supported(pb);
 	ECR_WRITE(pb, oecr);
@@ -1805,10 +1839,10 @@ static int parport_ECPEPP_supported(struct parport *pb)
 	if (!priv->ecr)
 		return 0;
 
-	oecr = inb(ECONTROL(pb));
+	oecr = parport_pc_readb(pb, ECONTROL(pb));
 	/* Search for SMC style EPP+ECP mode */
 	ECR_WRITE(pb, 0x80);
-	outb(0x04, CONTROL(pb));
+	parport_pc_writeb(pb, 0x04, CONTROL(pb));
 	result = parport_EPP_supported(pb);
 
 	ECR_WRITE(pb, oecr);
@@ -1857,14 +1891,14 @@ static int parport_ECPPS2_supported(struct parport *pb)
 static int programmable_irq_support(struct parport *pb)
 {
 	int irq, intrLine;
-	unsigned char oecr = inb(ECONTROL(pb));
+	unsigned char oecr = parport_pc_readb(pb, ECONTROL(pb));
 	static const int lookup[8] = {
 		PARPORT_IRQ_NONE, 7, 9, 10, 11, 14, 15, 5
 	};
 
 	ECR_WRITE(pb, ECR_CNF << 5); /* Configuration MODE */
 
-	intrLine = (inb(CONFIGB(pb)) >> 3) & 0x07;
+	intrLine = (parport_pc_readb(pb, CONFIGB(pb)) >> 3) & 0x07;
 	irq = lookup[intrLine];
 
 	ECR_WRITE(pb, oecr);
@@ -1883,8 +1917,9 @@ static int irq_probe_ECP(struct parport *pb)
 	ECR_WRITE(pb, ECR_TST << 5);
 
 	/* If Full FIFO sure that writeIntrThreshold is generated */
-	for (i = 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02) ; i++)
-		outb(0xaa, FIFO(pb));
+	for (i = 0; i < 1024 && !(parport_pc_readb(pb, ECONTROL(pb)) & 0x02);
+		i++)
+		parport_pc_writeb(pb, 0xaa, FIFO(pb));
 
 	pb->irq = probe_irq_off(irqs);
 	ECR_WRITE(pb, ECR_SPP << 5);
@@ -1908,7 +1943,7 @@ static int irq_probe_EPP(struct parport *pb)
 	unsigned char oecr;
 
 	if (pb->modes & PARPORT_MODE_PCECR)
-		oecr = inb(ECONTROL(pb));
+		oecr = parport_pc_readb(pb, ECONTROL(pb));
 
 	irqs = probe_irq_on();
 
@@ -1987,12 +2022,12 @@ static int parport_irq_probe(struct parport *pb)
 /* Only if chipset conforms to ECP ISA Interface Standard */
 static int programmable_dma_support(struct parport *p)
 {
-	unsigned char oecr = inb(ECONTROL(p));
+	unsigned char oecr = parport_pc_readb(p, ECONTROL(p));
 	int dma;
 
 	frob_set_mode(p, ECR_CNF);
 
-	dma = inb(CONFIGB(p)) & 0x07;
+	dma = parport_pc_readb(p, CONFIGB(p)) & 0x07;
 	/* 000: Indicates jumpered 8-bit DMA if read-only.
 	   100: Indicates jumpered 16-bit DMA if read-only. */
 	if ((dma & 0x03) == 0)
@@ -2067,10 +2102,25 @@ static struct parport *__parport_pc_probe_port(struct parport_data data,
 	if (!p)
 		goto out3;
 
+	p->mapbase = data.mapbase;
+	p->mapsize = data.mapsize;
+
 	if (p->iobase) {
-		base_res = request_region(data.iobase, 3, p->name);
+		base_res = request_region(p->iobase, 3, p->name);
 		if (!base_res)
 			goto out4;
+		p->iotype = PARPORT_IOPORT;
+	} else if (p->mapbase && p->mapsize >= 3) {
+		if (!request_mem_region(p->mapbase, p->mapsize,
+			"parport")) {
+			goto out4;
+		}
+		p->membase = ioremap(p->mapbase, p->mapsize);
+		if (!p->membase) {
+			release_mem_region(p->mapbase, p->mapsize);
+			goto out4;
+		}
+		p->iotype = PARPORT_IOMEM;
 	} else {
 		goto out4;
 	}
@@ -2087,22 +2137,35 @@ static struct parport *__parport_pc_probe_port(struct parport_data data,
 	priv->port = p;
 
 	p->dev = dev;
+	p->mapbase_hi = data.mapbase_hi;
+	p->mapsize_hi = data.mapsize_hi;
 	p->iobase_hi = data.iobase_hi;
 	p->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT;
 	p->private_data = priv;
 
 	if (p->iobase_hi) {
-		ECR_res = request_region(data.iobase_hi, 3, p->name);
+		ECR_res = request_region(p->iobase_hi, 3, p->name);
 		if (ECR_res)
 			parport_ECR_present(p);
+	} else if (p->mapbase_hi && (p->mapsize_hi >= 3)) {
+		if (request_mem_region(p->mapbase_hi, p->mapsize_hi,
+			"parport")) {
+			p->membase_hi = ioremap(p->mapbase_hi,
+							p->mapsize_hi);
+			if (!p->membase_hi)
+				release_mem_region(p->mapbase_hi,
+							p->mapsize_hi);
+			else
+				parport_ECR_present(p);
+		}
 	}
 
-	if (p->iobase != 0x3bc) {
-		EPP_res = request_region(data.iobase + 0x3, 5, p->name);
-		if (EPP_res)
-			if (!parport_EPP_supported(p))
-				parport_ECPEPP_supported(p);
-	}
+	if (p->iobase && (p->iobase != 0x3bc))
+		EPP_res = request_region(p->iobase + 0x3, 5, p->name);
+
+	if (EPP_res || p->mapsize >= 8)
+		if (!parport_EPP_supported(p))
+			parport_ECPEPP_supported(p);
 	if (!parport_SPP_supported(p))
 		/* No port. */
 		goto out5;
@@ -2113,9 +2176,12 @@ static struct parport *__parport_pc_probe_port(struct parport_data data,
 
 	p->size = (p->modes & PARPORT_MODE_EPP) ? 8 : 3;
 
-	pr_info("%s: PC-style at 0x%lx", p->name, p->iobase);
-	if (p->iobase_hi && priv->ecr)
-		pr_cont(" (0x%lx)", p->iobase_hi);
+	pr_info("%s: PC-style at 0x%lx", p->name,
+		is_ioport(p) ? p->iobase : (unsigned long)p->mapbase);
+	if ((p->iobase_hi || p->membase_hi) && priv->ecr)
+		pr_cont(" (0x%lx)",
+			is_ioport(p) ? p->iobase_hi :
+			(unsigned long)p->mapbase_hi);
 	if (p->irq == PARPORT_IRQ_AUTO) {
 		p->irq = PARPORT_IRQ_NONE;
 		parport_irq_probe(p);
@@ -2197,6 +2263,11 @@ do {									\
 		if (p->iobase_hi && ECR_res) {
 			release_region(p->iobase_hi, 3);
 			ECR_res = NULL;
+		} else if (p->membase_hi) {
+			iounmap(p->membase_hi);
+			release_mem_region(p->mapbase_hi,
+						p->mapsize_hi);
+			p->membase_hi = NULL;
 		}
 	}
 
@@ -2206,6 +2277,8 @@ do {									\
 		EPP_res = NULL;
 	}
 	if (p->irq != PARPORT_IRQ_NONE) {
+		if (!is_ioport(p))
+			irqflags |= IRQF_SHARED;
 		if (request_irq(p->irq, parport_irq_handler,
 				 irqflags, p->name, p)) {
 			pr_warn("%s: irq %d in use, resorting to polled operation\n",
@@ -2265,7 +2338,14 @@ do {									\
 		release_region(p->iobase_hi, 3);
 	if (EPP_res)
 		release_region(p->iobase + 0x3, 5);
-	release_region(p->iobase, 3);
+	if (is_ioport(p))
+		release_region(p->iobase, 3);
+	else {
+		iounmap(p->membase);
+		release_mem_region(p->mapbase, p->mapsize);
+		p->membase = NULL;
+	}
+
 out4:
 	parport_del_port(p);
 out3:
@@ -2314,10 +2394,16 @@ void parport_pc_unregister_port(struct parport *p)
 #endif
 	if (p->irq != PARPORT_IRQ_NONE)
 		free_irq(p->irq, p);
-	release_region(p->iobase, 3);
-	if (p->size > 3)
+	if (is_ioport(p)) {
+		release_region(p->iobase, 3);
+	} else {
+		iounmap(p->membase);
+		release_mem_region(p->mapbase, p->mapsize);
+		p->membase = NULL;
+	}
+	if (is_ioport(p) && p->size > 3)
 		release_region(p->iobase + 3, p->size - 3);
-	if (p->modes & PARPORT_MODE_ECP)
+	if (is_ioport(p) && (p->modes & PARPORT_MODE_ECP))
 		release_region(p->iobase_hi, 3);
 #if defined(CONFIG_PARPORT_PC_FIFO) && defined(HAS_DMA)
 	if (priv->dma_buf)
@@ -2355,7 +2441,7 @@ static int sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, int autodma,
 						0xe5000000 | inta_addr[i]);
 			pci_write_config_dword(pdev, 0x78,
 						0x00000000 | inta_addr[i]);
-			test = inb(inta_addr[i]);
+			test = parport_pc_readb(NULL, inta_addr[i]);
 			if (test != 0xff)
 				break;
 			release_region(inta_addr[i], 32);
@@ -2366,7 +2452,7 @@ static int sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, int autodma,
 		return 0;
 	}
 
-	type = inb(inta_addr[i] + 0x18);
+	type = parport_pc_readb(NULL, inta_addr[i] + 0x18);
 	type &= 0x0f;
 
 	switch (type) {
@@ -2513,34 +2599,36 @@ static int sio_via_probe(struct pci_dev *pdev, int autoirq, int autodma,
 	pci_write_config_byte(pdev, via->via_pci_superio_config_reg, tmp);
 
 	/* Bits 1-0: Parallel Port Mode / Enable */
-	outb(via->viacfg_function, VIA_CONFIG_INDEX);
-	tmp = inb(VIA_CONFIG_DATA);
+	parport_pc_writeb(NULL, via->viacfg_function, VIA_CONFIG_INDEX);
+	tmp = parport_pc_readb(NULL, VIA_CONFIG_DATA);
 	/* Bit 5: EPP+ECP enable; bit 7: PS/2 bidirectional port enable */
-	outb(via->viacfg_parport_control, VIA_CONFIG_INDEX);
-	tmp2 = inb(VIA_CONFIG_DATA);
+	parport_pc_writeb(NULL, via->viacfg_parport_control, VIA_CONFIG_INDEX);
+	tmp2 = parport_pc_readb(NULL, VIA_CONFIG_DATA);
 	if (siofunc == VIA_FUNCTION_PROBE) {
 		siofunc = tmp & VIA_FUNCTION_PARPORT_DISABLE;
 		ppcontrol = tmp2;
 	} else {
 		tmp &= ~VIA_FUNCTION_PARPORT_DISABLE;
 		tmp |= siofunc;
-		outb(via->viacfg_function, VIA_CONFIG_INDEX);
-		outb(tmp, VIA_CONFIG_DATA);
+		parport_pc_writeb(NULL, via->viacfg_function, VIA_CONFIG_INDEX);
+		parport_pc_writeb(NULL, tmp, VIA_CONFIG_DATA);
 		tmp2 &= ~(VIA_PARPORT_BIDIR|VIA_PARPORT_ECPEPP);
 		tmp2 |= ppcontrol;
-		outb(via->viacfg_parport_control, VIA_CONFIG_INDEX);
-		outb(tmp2, VIA_CONFIG_DATA);
+		parport_pc_writeb(NULL, via->viacfg_parport_control,
+				VIA_CONFIG_INDEX);
+		parport_pc_writeb(NULL, tmp2, VIA_CONFIG_DATA);
 	}
 
 	/* Parallel Port I/O Base Address, bits 9-2 */
-	outb(via->viacfg_parport_base, VIA_CONFIG_INDEX);
-	port1 = inb(VIA_CONFIG_DATA) << 2;
+	parport_pc_writeb(NULL, via->viacfg_parport_base, VIA_CONFIG_INDEX);
+	port1 = parport_pc_readb(NULL, VIA_CONFIG_DATA) << 2;
 
 	printk(KERN_DEBUG "parport_pc: Current parallel port base: 0x%X\n",
 	       port1);
 	if (port1 == 0x3BC && have_epp) {
-		outb(via->viacfg_parport_base, VIA_CONFIG_INDEX);
-		outb((0x378 >> 2), VIA_CONFIG_DATA);
+		parport_pc_writeb(NULL, via->viacfg_parport_base,
+				VIA_CONFIG_INDEX);
+		parport_pc_writeb(NULL, (0x378 >> 2), VIA_CONFIG_DATA);
 		printk(KERN_DEBUG "parport_pc: Parallel port base changed to 0x378\n");
 		port1 = 0x378;
 	}
@@ -3029,12 +3117,20 @@ static int parport_pc_pnp_probe(struct pnp_dev *dev,
 	if (pnp_port_valid(dev, 0) &&
 		!(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) {
 		tmp_pdata.iobase = pnp_port_start(dev, 0);
+	} else if (pnp_mem_valid(dev, 0) &&
+		!(pnp_mem_flags(dev, 0) & IORESOURCE_DISABLED)) {
+		tmp_pdata.mapbase = pnp_mem_start(dev, 0);
+		tmp_pdata.mapsize = pnp_mem_len(dev, 0);
 	} else
 		return -EINVAL;
 
 	if (pnp_port_valid(dev, 1) &&
 		!(pnp_port_flags(dev, 1) & IORESOURCE_DISABLED)) {
 		tmp_pdata.iobase_hi = pnp_port_start(dev, 1);
+	} else if (pnp_mem_valid(dev, 1) &&
+		!(pnp_mem_flags(dev, 1) & IORESOURCE_DISABLED)) {
+		tmp_pdata.mapbase_hi = pnp_mem_start(dev, 1);
+		tmp_pdata.mapsize_hi = pnp_mem_len(dev, 1);
 	} else
 		tmp_pdata.iobase_hi = 0;
 
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 308eadce42dd..fe034eb68514 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -180,19 +180,37 @@ struct ieee1284_info {
 	struct semaphore irq;
 };
 
+#define PARPORT_IOPORT 1
+#define PARPORT_IOMEM  2
+
 struct parport_data {
+	unsigned char iotype;   /* io access style */
 	/* for ioport */
 	unsigned long iobase;   /* base address for ioport */
 	unsigned long iobase_hi;        /* base address (hi - ECR) */
+	/* for iomem */
+	resource_size_t mapbase;        /* base address for iomem */
+	resource_size_t mapsize;
+	resource_size_t mapbase_hi;     /* base address (hi - ECR) */
+	resource_size_t mapsize_hi;
 	int irq;
 	int dma;
 };
 
 /* A parallel port */
 struct parport {
+	unsigned char iotype;   /* io access style */
+	/* for ioport */
 	unsigned long iobase;	/* base address for ioport */
 	unsigned long iobase_hi;  /* base address (hi - ECR) */
 	unsigned int size;	/* IO extent */
+	/* for iomem */
+	resource_size_t mapbase;        /* base address for iomem */
+	resource_size_t mapsize;
+	resource_size_t mapbase_hi;     /* base address for iomem */
+	resource_size_t mapsize_hi;
+	unsigned char __iomem   *membase;       /* read/write[bwl] */
+	unsigned char __iomem   *membase_hi;    /* read/write[bwl] */
 	const char *name;
 	unsigned int modes;
 	int irq;		/* interrupt (or -1 for none) */
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index d6c3f323caa1..b7acf35a5f91 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -5,16 +5,20 @@
 #include <asm/io.h>
 
 /* --- register definitions ------------------------------- */
-
-#define ECONTROL(p) ((p)->iobase_hi + 0x2)
-#define CONFIGB(p)  ((p)->iobase_hi + 0x1)
-#define CONFIGA(p)  ((p)->iobase_hi + 0x0)
-#define FIFO(p)     ((p)->iobase_hi + 0x0)
-#define EPPDATA(p)  ((p)->iobase    + 0x4)
-#define EPPADDR(p)  ((p)->iobase    + 0x3)
-#define CONTROL(p)  ((p)->iobase    + 0x2)
-#define STATUS(p)   ((p)->iobase    + 0x1)
-#define DATA(p)     ((p)->iobase    + 0x0)
+#define is_ioport(p)   (p == NULL || (p)->iotype == PARPORT_IOPORT)
+#define get_base(p)    (is_ioport(p) ? (p)->iobase :\
+				(unsigned long)(p)->membase)
+#define get_base_hi(p) (is_ioport(p) ? (p)->iobase_hi :\
+				(unsigned long)(p)->membase_hi)
+#define ECONTROL(p)    (get_base_hi(p) + 0x2)
+#define CONFIGB(p)     (get_base_hi(p) + 0x1)
+#define CONFIGA(p)     (get_base_hi(p) + 0x0)
+#define FIFO(p)                (get_base_hi(p) + 0x0)
+#define EPPDATA(p)     (get_base(p) + 0x4)
+#define EPPADDR(p)     (get_base(p) + 0x3)
+#define CONTROL(p)     (get_base(p) + 0x2)
+#define STATUS(p)      (get_base(p) + 0x1)
+#define DATA(p)                (get_base(p) + 0x0)
 
 struct parport_pc_private {
 	/* Contents of CTR. */
@@ -63,17 +67,78 @@ struct parport_pc_via_data
 	u8 viacfg_parport_base;
 };
 
+static inline void parport_pc_writeb(struct parport *p,
+					unsigned char d,
+					unsigned long addr)
+{
+	is_ioport(p) ? outb(d, addr) : writeb(d, (void __iomem *)addr);
+}
+
+static inline void parport_pc_writesb(struct parport *p,
+					unsigned long addr, const void *buf,
+					unsigned int count)
+{
+	is_ioport(p) ? outsb(addr, buf, count) :
+			writesb((void __iomem *)addr, buf, count);
+}
+
+static inline void parport_pc_writesl(struct parport *p,
+					unsigned long addr, const void *buf,
+					unsigned int count)
+{
+	is_ioport(p) ? outsl(addr, buf, count) :
+			writesl((void __iomem *)addr, buf, count);
+}
+
+static inline void parport_pc_writesw(struct parport *p,
+					unsigned long addr, const void *buf,
+					unsigned int count)
+{
+	is_ioport(p) ? outsw(addr, buf, count) :
+	writesw((void __iomem *)addr, buf, count);
+}
+
+static inline unsigned char parport_pc_readb(struct parport *p,
+						unsigned long addr)
+{
+	return is_ioport(p) ? inb(addr) : readb((void __iomem *)addr);
+}
+
+static inline void parport_pc_readsb(struct parport *p,
+					unsigned long addr, void *buf,
+					unsigned int count)
+{
+	is_ioport(p) ? insb(addr, buf, count) :
+			readsb((void __iomem *)addr, buf, count);
+}
+
+static inline void parport_pc_readsl(struct parport *p,
+					unsigned long addr, void *buf,
+					unsigned int count)
+{
+	is_ioport(p) ? insl(addr, buf, count) :
+			readsl((void __iomem *)addr, buf, count);
+}
+
+static inline void parport_pc_readsw(struct parport *p,
+					unsigned long addr, void *buf,
+					unsigned int count)
+{
+	is_ioport(p) ? insw(addr, buf, count) :
+			readsw((void __iomem *)addr, buf, count);
+}
+
 static __inline__ void parport_pc_write_data(struct parport *p, unsigned char d)
 {
 #ifdef DEBUG_PARPORT
 	printk (KERN_DEBUG "parport_pc_write_data(%p,0x%02x)\n", p, d);
 #endif
-	outb(d, DATA(p));
+	parport_pc_writeb(p, d, DATA(p));
 }
 
 static __inline__ unsigned char parport_pc_read_data(struct parport *p)
 {
-	unsigned char val = inb (DATA (p));
+	unsigned char val = parport_pc_readb(p, DATA(p));
 #ifdef DEBUG_PARPORT
 	printk (KERN_DEBUG "parport_pc_read_data(%p) = 0x%02x\n",
 		p, val);
@@ -85,9 +150,9 @@ static __inline__ unsigned char parport_pc_read_data(struct parport *p)
 static inline void dump_parport_state (char *str, struct parport *p)
 {
 	/* here's hoping that reading these ports won't side-effect anything underneath */
-	unsigned char ecr = inb (ECONTROL (p));
-	unsigned char dcr = inb (CONTROL (p));
-	unsigned char dsr = inb (STATUS (p));
+	unsigned char ecr = parport_pc_readb(p, ECONTROL(p));
+	unsigned char dcr = parport_pc_readb(p, CONTROL(p));
+	unsigned char dsr = parport_pc_readb(p, STATUS(p));
 	static const char *const ecr_modes[] = {"SPP", "PS2", "PPFIFO", "ECP", "xXx", "yYy", "TST", "CFG"};
 	const struct parport_pc_private *priv = p->physport->private_data;
 	int i;
@@ -100,7 +165,7 @@ static inline void dump_parport_state (char *str, struct parport *p)
 	if (ecr & 0x01) printk (",f_empty");
 	for (i=0; i<2; i++) {
 		printk ("]  dcr(%s)=[", i ? "soft" : "hard");
-		dcr = i ? priv->ctr : inb (CONTROL (p));
+		dcr = i ? priv->ctr : parport_pc_readb(p, CONTROL(p));
 	
 		if (dcr & 0x20) {
 			printk ("rev");
@@ -141,7 +206,7 @@ static __inline__ unsigned char __parport_pc_frob_control (struct parport *p,
 #endif
 	ctr = (ctr & ~mask) ^ val;
 	ctr &= priv->ctr_writable; /* only write writable bits. */
-	outb (ctr, CONTROL (p));
+	parport_pc_writeb(p, ctr, CONTROL(p));
 	priv->ctr = ctr;	/* Update soft copy */
 	return ctr;
 }
@@ -213,7 +278,7 @@ static __inline__ unsigned char parport_pc_frob_control (struct parport *p,
 
 static __inline__ unsigned char parport_pc_read_status(struct parport *p)
 {
-	return inb(STATUS(p));
+	return parport_pc_readb(p, STATUS(p));
 }
 
 
-- 
2.25.1


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

* Re: [PATCH 2/4] parport: change struct parport member to iobase
  2024-10-25  8:21 ` [PATCH 2/4] parport: change struct parport member to iobase 412574090
@ 2024-10-25 21:58   ` kernel test robot
  2024-10-25 22:29   ` kernel test robot
  1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2024-10-25 21:58 UTC (permalink / raw)
  To: 412574090, sudipm.mukherjee
  Cc: oe-kbuild-all, linux-kernel, xiongxin, weiyufeng

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.12-rc4 next-20241025]
[cannot apply to deller-parisc/for-next mkp-scsi/for-next jejb-scsi/for-next tiwai-sound/for-next tiwai-sound/for-linus]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/412574090-163-com/parport-change-struct-parport-member-to-iobase/20241025-162302
base:   linus/master
patch link:    https://lore.kernel.org/r/20241025082128.60034-2-412574090%40163.com
patch subject: [PATCH 2/4] parport: change struct parport member to iobase
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20241026/202410260507.aPp3LOTd-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241026/202410260507.aPp3LOTd-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410260507.aPp3LOTd-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   drivers/parport/parport_mfc3.c: In function 'mfc3_write_data':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:84:17: note: in expansion of macro 'pia'
      84 |         dummy = pia(p)->pprb; /* clears irq bit */
         |                 ^~~
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:86:9: note: in expansion of macro 'pia'
      86 |         pia(p)->pprb = data;
         |         ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_read_data':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:92:16: note: in expansion of macro 'pia'
      92 |         return pia(p)->pprb;
         |                ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_write_control':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:126:9: note: in expansion of macro 'pia'
     126 |         pia(p)->ppra = (pia(p)->ppra & 0x1f) | control_pc_to_mfc3(control);
         |         ^~~
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:126:25: note: in expansion of macro 'pia'
     126 |         pia(p)->ppra = (pia(p)->ppra & 0x1f) | control_pc_to_mfc3(control);
         |                         ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_read_control':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:132:35: note: in expansion of macro 'pia'
     132 |         return control_mfc3_to_pc(pia(p)->ppra & 0xe0);
         |                                   ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_read_status':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:167:36: note: in expansion of macro 'pia'
     167 |         status = status_mfc3_to_pc(pia(p)->ppra & 0x1f);
         |                                    ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_interrupt':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:180:29: note: in expansion of macro 'pia'
     180 |                         if (pia(this_port[i])->crb & 128) { /* Board caused interrupt */
         |                             ^~~
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:181:41: note: in expansion of macro 'pia'
     181 |                                 dummy = pia(this_port[i])->pprb; /* clear irq bit */
         |                                         ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_enable_irq':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:189:9: note: in expansion of macro 'pia'
     189 |         pia(p)->crb |= PIA_C1_ENABLE_IRQ;
         |         ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_disable_irq':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:194:9: note: in expansion of macro 'pia'
     194 |         pia(p)->crb &= ~PIA_C1_ENABLE_IRQ;
         |         ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_data_forward':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:200:9: note: in expansion of macro 'pia'
     200 |         pia(p)->crb &= ~PIA_DDR; /* make data direction register visible */
         |         ^~~
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:201:9: note: in expansion of macro 'pia'
     201 |         pia(p)->pddrb = 255; /* all pins output */
         |         ^~~
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:202:9: note: in expansion of macro 'pia'
     202 |         pia(p)->crb |= PIA_DDR; /* make data register visible - default */
         |         ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_data_reverse':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:208:9: note: in expansion of macro 'pia'
     208 |         pia(p)->crb &= ~PIA_DDR; /* make data direction register visible */
         |         ^~~
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:209:9: note: in expansion of macro 'pia'
     209 |         pia(p)->pddrb = 0; /* all pins input */
         |         ^~~
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:210:9: note: in expansion of macro 'pia'
     210 |         pia(p)->crb |= PIA_DDR; /* make data register visible - default */
         |         ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_save_state':
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:223:27: note: in expansion of macro 'pia'
     223 |         s->u.amiga.data = pia(p)->pprb;
         |                           ^~~
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:224:9: note: in expansion of macro 'pia'
     224 |         pia(p)->crb &= ~PIA_DDR;
         |         ^~~
>> drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:225:30: note: in expansion of macro 'pia'
     225 |         s->u.amiga.datadir = pia(p)->pddrb;
         |                              ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:226:9: note: in expansion of macro 'pia'
     226 |         pia(p)->crb |= PIA_DDR;
         |         ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:227:29: note: in expansion of macro 'pia'
     227 |         s->u.amiga.status = pia(p)->ppra;
         |                             ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:228:9: note: in expansion of macro 'pia'
     228 |         pia(p)->cra &= ~PIA_DDR;
         |         ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:229:32: note: in expansion of macro 'pia'
     229 |         s->u.amiga.statusdir = pia(p)->pddrb;
         |                                ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:230:9: note: in expansion of macro 'pia'
     230 |         pia(p)->cra |= PIA_DDR;
         |         ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_restore_state':
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:235:9: note: in expansion of macro 'pia'
     235 |         pia(p)->pprb = s->u.amiga.data;
         |         ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:236:9: note: in expansion of macro 'pia'
     236 |         pia(p)->crb &= ~PIA_DDR;
         |         ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:237:9: note: in expansion of macro 'pia'
     237 |         pia(p)->pddrb = s->u.amiga.datadir;
         |         ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:238:9: note: in expansion of macro 'pia'
     238 |         pia(p)->crb |= PIA_DDR;
         |         ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:239:9: note: in expansion of macro 'pia'
     239 |         pia(p)->ppra = s->u.amiga.status;
         |         ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:240:9: note: in expansion of macro 'pia'
     240 |         pia(p)->cra &= ~PIA_DDR;
         |         ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:241:9: note: in expansion of macro 'pia'
     241 |         pia(p)->pddrb = s->u.amiga.statusdir;
         |         ^~~
   drivers/parport/parport_mfc3.c:77:39: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
      77 | #define pia(dev) ((struct pia *)(dev->base))
         |                                       ^~~~
   drivers/parport/parport_mfc3.c:242:9: note: in expansion of macro 'pia'
     242 |         pia(p)->cra |= PIA_DDR;
         |         ^~~
   drivers/parport/parport_mfc3.c: In function 'mfc3_read_control':
   drivers/parport/parport_mfc3.c:133:1: warning: control reaches end of non-void function [-Wreturn-type]
     133 | }
         | ^
   drivers/parport/parport_mfc3.c: In function 'mfc3_read_data':
   drivers/parport/parport_mfc3.c:93:1: warning: control reaches end of non-void function [-Wreturn-type]
      93 | }
         | ^

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for GET_FREE_REGION
   Depends on [n]: SPARSEMEM [=n]
   Selected by [m]:
   - RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]


vim +77 drivers/parport/parport_mfc3.c

^1da177e4c3f41 Linus Torvalds 2005-04-16   76  
^1da177e4c3f41 Linus Torvalds 2005-04-16  @77  #define pia(dev) ((struct pia *)(dev->base))
^1da177e4c3f41 Linus Torvalds 2005-04-16   78  static struct parport_operations pp_mfc3_ops;
^1da177e4c3f41 Linus Torvalds 2005-04-16   79  
^1da177e4c3f41 Linus Torvalds 2005-04-16   80  static void mfc3_write_data(struct parport *p, unsigned char data)
^1da177e4c3f41 Linus Torvalds 2005-04-16   81  {
46aea0d41cf836 Joe Perches    2020-04-03   82  	pr_debug("write_data %c\n", data);
^1da177e4c3f41 Linus Torvalds 2005-04-16   83  
^1da177e4c3f41 Linus Torvalds 2005-04-16   84  	dummy = pia(p)->pprb; /* clears irq bit */
^1da177e4c3f41 Linus Torvalds 2005-04-16   85  	/* Triggers also /STROBE.*/
^1da177e4c3f41 Linus Torvalds 2005-04-16   86  	pia(p)->pprb = data;
^1da177e4c3f41 Linus Torvalds 2005-04-16   87  }
^1da177e4c3f41 Linus Torvalds 2005-04-16   88  
^1da177e4c3f41 Linus Torvalds 2005-04-16   89  static unsigned char mfc3_read_data(struct parport *p)
^1da177e4c3f41 Linus Torvalds 2005-04-16   90  {
^1da177e4c3f41 Linus Torvalds 2005-04-16   91  	/* clears interrupt bit. Triggers also /STROBE. */
^1da177e4c3f41 Linus Torvalds 2005-04-16   92  	return pia(p)->pprb;
^1da177e4c3f41 Linus Torvalds 2005-04-16   93  }
^1da177e4c3f41 Linus Torvalds 2005-04-16   94  
^1da177e4c3f41 Linus Torvalds 2005-04-16   95  static unsigned char control_pc_to_mfc3(unsigned char control)
^1da177e4c3f41 Linus Torvalds 2005-04-16   96  {
^1da177e4c3f41 Linus Torvalds 2005-04-16   97  	unsigned char ret = 32|64;
^1da177e4c3f41 Linus Torvalds 2005-04-16   98  
^1da177e4c3f41 Linus Torvalds 2005-04-16   99  	if (control & PARPORT_CONTROL_SELECT) /* XXX: What is SELECP? */
^1da177e4c3f41 Linus Torvalds 2005-04-16  100  		ret &= ~32; /* /SELECT_IN */
^1da177e4c3f41 Linus Torvalds 2005-04-16  101  	if (control & PARPORT_CONTROL_INIT) /* INITP */
^1da177e4c3f41 Linus Torvalds 2005-04-16  102  		ret |= 128;
^1da177e4c3f41 Linus Torvalds 2005-04-16  103  	if (control & PARPORT_CONTROL_AUTOFD) /* AUTOLF */
^1da177e4c3f41 Linus Torvalds 2005-04-16  104  		ret &= ~64;
1d6b84d29779f8 Arnd Bergmann  2024-04-05  105  	/* PARPORT_CONTROL_STROBE handled directly by hardware */
^1da177e4c3f41 Linus Torvalds 2005-04-16  106  	return ret;
^1da177e4c3f41 Linus Torvalds 2005-04-16  107  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  108  
^1da177e4c3f41 Linus Torvalds 2005-04-16  109  static unsigned char control_mfc3_to_pc(unsigned char control)
^1da177e4c3f41 Linus Torvalds 2005-04-16  110  {
^1da177e4c3f41 Linus Torvalds 2005-04-16  111  	unsigned char ret = PARPORT_CONTROL_STROBE 
^1da177e4c3f41 Linus Torvalds 2005-04-16  112  			  | PARPORT_CONTROL_AUTOFD | PARPORT_CONTROL_SELECT;
^1da177e4c3f41 Linus Torvalds 2005-04-16  113  
^1da177e4c3f41 Linus Torvalds 2005-04-16  114  	if (control & 128) /* /INITP */
^1da177e4c3f41 Linus Torvalds 2005-04-16  115  		ret |= PARPORT_CONTROL_INIT;
^1da177e4c3f41 Linus Torvalds 2005-04-16  116  	if (control & 64) /* /AUTOLF */
^1da177e4c3f41 Linus Torvalds 2005-04-16  117  		ret &= ~PARPORT_CONTROL_AUTOFD;
^1da177e4c3f41 Linus Torvalds 2005-04-16  118  	if (control & 32) /* /SELECT_IN */
^1da177e4c3f41 Linus Torvalds 2005-04-16  119  		ret &= ~PARPORT_CONTROL_SELECT;
^1da177e4c3f41 Linus Torvalds 2005-04-16  120  	return ret;
^1da177e4c3f41 Linus Torvalds 2005-04-16  121  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  122  
^1da177e4c3f41 Linus Torvalds 2005-04-16  123  static void mfc3_write_control(struct parport *p, unsigned char control)
^1da177e4c3f41 Linus Torvalds 2005-04-16  124  {
46aea0d41cf836 Joe Perches    2020-04-03  125  	pr_debug("write_control %02x\n", control);
^1da177e4c3f41 Linus Torvalds 2005-04-16  126  	pia(p)->ppra = (pia(p)->ppra & 0x1f) | control_pc_to_mfc3(control);
^1da177e4c3f41 Linus Torvalds 2005-04-16  127  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  128  	
^1da177e4c3f41 Linus Torvalds 2005-04-16  129  static unsigned char mfc3_read_control( struct parport *p)
^1da177e4c3f41 Linus Torvalds 2005-04-16  130  {
46aea0d41cf836 Joe Perches    2020-04-03  131  	pr_debug("read_control\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16  132  	return control_mfc3_to_pc(pia(p)->ppra & 0xe0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 @133  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  134  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH 2/4] parport: change struct parport member to iobase
  2024-10-25  8:21 ` [PATCH 2/4] parport: change struct parport member to iobase 412574090
  2024-10-25 21:58   ` kernel test robot
@ 2024-10-25 22:29   ` kernel test robot
  1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2024-10-25 22:29 UTC (permalink / raw)
  To: 412574090, sudipm.mukherjee
  Cc: oe-kbuild-all, linux-kernel, xiongxin, weiyufeng

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.12-rc4 next-20241025]
[cannot apply to deller-parisc/for-next mkp-scsi/for-next jejb-scsi/for-next tiwai-sound/for-next tiwai-sound/for-linus]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/412574090-163-com/parport-change-struct-parport-member-to-iobase/20241025-162302
base:   linus/master
patch link:    https://lore.kernel.org/r/20241025082128.60034-2-412574090%40163.com
patch subject: [PATCH 2/4] parport: change struct parport member to iobase
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20241026/202410260604.8KzF4khS-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241026/202410260604.8KzF4khS-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410260604.8KzF4khS-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/ata/pata_parport/pata_parport.c: In function 'pi_init_one':
>> drivers/ata/pata_parport/pata_parport.c:542:29: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
     542 |         pi->port = parport->base;
         |                             ^~~~
         |                             iobase
--
   In file included from include/linux/device.h:15,
                    from include/linux/parport.h:16,
                    from drivers/ata/pata_parport/bpck6.c:16:
   drivers/ata/pata_parport/bpck6.c: In function 'bpck6_test_port':
>> drivers/ata/pata_parport/bpck6.c:397:60: error: 'struct parport' has no member named 'base'; did you mean 'iobase'?
     397 |                 pi->pardev->port->modes, pi->pardev->port->base);
         |                                                            ^~~~
   include/linux/dev_printk.h:139:56: note: in definition of macro 'dev_no_printk'
     139 |                         _dev_printk(level, dev, fmt, ##__VA_ARGS__);    \
         |                                                        ^~~~~~~~~~~
   drivers/ata/pata_parport/bpck6.c:396:9: note: in expansion of macro 'dev_dbg'
     396 |         dev_dbg(&pi->dev, "PARPORT indicates modes=%x for lp=0x%lx\n",
         |         ^~~~~~~


vim +542 drivers/ata/pata_parport/pata_parport.c

246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  492  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  493  static struct pi_adapter *pi_init_one(struct parport *parport,
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  494  			struct pi_protocol *pr, int mode, int unit, int delay)
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  495  {
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  496  	struct pardev_cb par_cb = { };
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  497  	const struct ata_port_info *ppi[] = { &pata_parport_port_info };
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  498  	struct ata_host *host;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  499  	struct pi_adapter *pi;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  500  	struct pi_device_match match = { .parport = parport, .proto = pr };
8844f0aa8dc42f drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-02-04  501  	int id;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  502  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  503  	/*
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  504  	 * Abort if there's a device already registered on the same parport
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  505  	 * using the same protocol.
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  506  	 */
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  507  	if (bus_for_each_dev(&pata_parport_bus_type, NULL, &match, pi_find_dev))
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  508  		return NULL;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  509  
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  510  	id = ida_alloc(&pata_parport_bus_dev_ids, GFP_KERNEL);
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  511  	if (id < 0)
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  512  		return NULL;
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  513  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  514  	pi = kzalloc(sizeof(struct pi_adapter), GFP_KERNEL);
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  515  	if (!pi) {
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  516  		ida_free(&pata_parport_bus_dev_ids, id);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  517  		return NULL;
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  518  	}
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  519  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  520  	/* set up pi->dev before pi_probe_unit() so it can use dev_printk() */
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  521  	pi->dev.parent = &pata_parport_bus;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  522  	pi->dev.bus = &pata_parport_bus_type;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  523  	pi->dev.driver = &pr->driver;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  524  	pi->dev.release = pata_parport_dev_release;
8844f0aa8dc42f drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-02-04  525  	pi->dev.id = id;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  526  	dev_set_name(&pi->dev, "pata_parport.%u", pi->dev.id);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  527  	if (device_register(&pi->dev)) {
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  528  		put_device(&pi->dev);
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  529  		/* pata_parport_dev_release will do ida_free(dev->id) and kfree(pi) */
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  530  		return NULL;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  531  	}
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  532  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  533  	pi->proto = pr;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  534  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  535  	if (!try_module_get(pi->proto->owner))
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  536  		goto out_unreg_dev;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  537  	if (pi->proto->init_proto && pi->proto->init_proto(pi) < 0)
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  538  		goto out_module_put;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  539  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  540  	pi->delay = (delay == -1) ? pi->proto->default_delay : delay;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  541  	pi->mode = mode;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23 @542  	pi->port = parport->base;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  543  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  544  	par_cb.private = pi;
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  545  	pi->pardev = parport_register_dev_model(parport, DRV_NAME, &par_cb, id);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  546  	if (!pi->pardev)
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  547  		goto out_module_put;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  548  
b42251a867a985 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-02-18  549  	if (!pi_probe_unit(pi, unit)) {
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  550  		dev_info(&pi->dev, "Adapter not found\n");
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  551  		goto out_unreg_parport;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  552  	}
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  553  
5b77db9ccff444 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-02-18  554  	pi->proto->log_adapter(pi);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  555  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  556  	host = ata_host_alloc_pinfo(&pi->pardev->dev, ppi, 1);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  557  	if (!host)
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  558  		goto out_unreg_parport;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  559  	dev_set_drvdata(&pi->dev, host);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  560  	host->private_data = pi;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  561  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  562  	ata_port_desc(host->ports[0], "port %s", pi->pardev->port->name);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  563  	ata_port_desc(host->ports[0], "protocol %s", pi->proto->name);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  564  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  565  	pi_connect(pi);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  566  	if (ata_host_activate(host, 0, NULL, 0, &pata_parport_sht))
dc472c7612297f drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-11  567  		goto out_disconnect;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  568  
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  569  	return pi;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  570  
dc472c7612297f drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-11  571  out_disconnect:
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  572  	pi_disconnect(pi);
dc472c7612297f drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-11  573  out_unreg_parport:
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  574  	parport_unregister_device(pi->pardev);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  575  	if (pi->proto->release_proto)
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  576  		pi->proto->release_proto(pi);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  577  out_module_put:
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  578  	module_put(pi->proto->owner);
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  579  out_unreg_dev:
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  580  	device_unregister(&pi->dev);
5bc9e2d43f8610 drivers/ata/pata_parport/pata_parport.c Ondrej Zary 2023-03-14  581  	/* pata_parport_dev_release will do ida_free(dev->id) and kfree(pi) */
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  582  	return NULL;
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  583  }
246a1c4c6b7ffb drivers/ata/pata_parport.c              Ondrej Zary 2023-01-23  584  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-10-25 22:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-25  8:21 [PATCH 1/4] parport: use standard kernel printing functions 412574090
2024-10-25  8:21 ` [PATCH 2/4] parport: change struct parport member to iobase 412574090
2024-10-25 21:58   ` kernel test robot
2024-10-25 22:29   ` kernel test robot
2024-10-25  8:21 ` [PATCH 3/4] parport: add parport_data struct 412574090
2024-10-25  8:21 ` [PATCH 4/4] parport: add iomem type for parport 412574090

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.