linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-serial@vger.kernel.org
Subject: [PATCH 7/7] serial/8250: make PIO support optional
Date: Mon, 27 Jun 2011 23:45:20 +0200	[thread overview]
Message-ID: <1309211120-2803-8-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1309211120-2803-1-git-send-email-arnd@arndb.de>

It is not currently possible to build support for the 8250 UART
on architectures that don't define PC-style I/O accessors like
inb/outb. Most embedded systems without PCI don't actually have
PC-style I/O, so they should not have to make up their own
accessors.

This makes the PIO support in the 8250 driver completely
conditional on CONFIG_HAS_IOPORT so we can remove the bogus
definitions from all the places that only need them for 8250.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-serial@vger.kernel.org
---
 drivers/tty/serial/8250.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index 2b06c27..a2933d6 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -318,6 +318,7 @@ static unsigned int mem32_serial_in(struct uart_port *p, int offset)
 	return readl(p->membase + offset);
 }
 
+#ifdef CONFIG_HAS_IOPORT
 static unsigned int io_serial_in(struct uart_port *p, int offset)
 {
 	offset = map_8250_in_reg(p, offset) << p->regshift;
@@ -329,16 +330,19 @@ static void io_serial_out(struct uart_port *p, int offset, int value)
 	offset = map_8250_out_reg(p, offset) << p->regshift;
 	outb(value, p->iobase + offset);
 }
+#endif
 
 static void set_io_from_upio(struct uart_port *p)
 {
 	struct uart_8250_port *up =
 		container_of(p, struct uart_8250_port, port);
 	switch (p->iotype) {
-	case UPIO_MEM:
-		p->serial_in = mem_serial_in;
-		p->serial_out = mem_serial_out;
+#ifdef CONFIG_HAS_IOPORT
+	case UPIO_PORT:
+		p->serial_in = io_serial_in;
+		p->serial_out = io_serial_out;
 		break;
+#endif
 
 	case UPIO_MEM32:
 		p->serial_in = mem32_serial_in;
@@ -346,9 +350,10 @@ static void set_io_from_upio(struct uart_port *p)
 		break;
 
 	default:
-		p->serial_in = io_serial_in;
-		p->serial_out = io_serial_out;
+		p->serial_in = mem_serial_in;
+		p->serial_out = mem_serial_out;
 		break;
+
 	}
 	/* Remember loaded iotype */
 	up->cur_iotype = p->iotype;
@@ -2250,12 +2255,13 @@ static int serial8250_request_port(struct uart_port *port)
 			}
 		}
 		break;
-
+#ifdef CONFIG_HAS_IOPORT
 	case UPIO_HUB6:
 	case UPIO_PORT:
 		if (!request_region(up->port.iobase, size, "serial"))
 			ret = -EBUSY;
 		break;
+#endif
 	}
 	return ret;
 }
@@ -2282,10 +2288,12 @@ static void serial8250_release_port(struct uart_port *port)
 		release_mem_region(up->port.mapbase, size);
 		break;
 
+#ifdef CONFIG_HAS_IOPORT
 	case UPIO_HUB6:
 	case UPIO_PORT:
 		release_region(up->port.iobase, size);
 		break;
+#endif
 	}
 }
 
-- 
1.7.5.4


  parent reply	other threads:[~2011-06-27 21:46 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-27 21:45 [PATCH 0/7] serial/8250: I/O accessor cleanups Arnd Bergmann
2011-06-27 21:45 ` [PATCH 1/7] serial/8250: remove obsolete RM9000 port type Arnd Bergmann
2011-06-27 21:45 ` [PATCH 2/7] serial/8250: move alchemy I/O handler to platform code Arnd Bergmann
2011-06-28  8:06   ` Manuel Lauss
2011-06-28 11:29   ` Manuel Lauss
2011-06-28 15:36     ` Manuel Lauss
2011-06-28 17:07       ` Arnd Bergmann
2011-06-27 21:45 ` [PATCH 3/7] serial/8250: move UPIO_TSI to powerpc Arnd Bergmann
2011-06-27 23:51   ` David Daney
2011-09-01  6:02   ` Benjamin Herrenschmidt
2011-09-01  8:28     ` Arnd Bergmann
2011-06-27 21:45 ` [PATCH 4/7] serial/8250: move DWAP support to arch/mips Arnd Bergmann
2011-06-27 22:15   ` Jamie Iles
2011-06-28  5:43     ` Arnd Bergmann
2011-06-28 10:06   ` Alan Cox
2011-06-28 10:48     ` Arnd Bergmann
2011-06-27 21:45 ` [PATCH 5/7] serial/8250: remove obsolete and broken PORT_RSA support Arnd Bergmann
2011-06-28 10:11   ` Alan Cox
2011-06-27 21:45 ` [PATCH 6/7] serial/8250: sanitize fourport handling Arnd Bergmann
2011-06-28 10:10   ` Alan Cox
2011-06-28 12:07     ` Arnd Bergmann
2011-06-27 21:45 ` Arnd Bergmann [this message]
2011-06-28 10:05   ` [PATCH 7/7] serial/8250: make PIO support optional Alan Cox
2011-06-28 11:52     ` Arnd Bergmann
2011-06-28 12:22       ` Alan Cox
2011-07-04 16:35         ` Arnd Bergmann
2011-07-04 17:02           ` Alan Cox
2011-07-04 19:27             ` Arnd Bergmann
2011-07-04 19:53               ` Alan Cox
2011-07-04 20:37                 ` Arnd Bergmann
2011-07-04 21:55                   ` Alan Cox
2011-07-04 21:54                     ` Arnd Bergmann
2011-06-28 10:11   ` Alan Cox
2011-06-27 23:57 ` [PATCH 0/7] serial/8250: I/O accessor cleanups David Daney

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=1309211120-2803-8-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

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

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