Linux Serial subsystem development
 help / color / mirror / Atom feed
From: "Enrico Weigelt, metux IT consult" <info@metux.net>
To: gregkh@linuxfoundation.org, jslaby@suse.com,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 7/8] drivers: tty: serial: use memres
Date: Tue, 12 Mar 2019 15:57:39 +0100	[thread overview]
Message-ID: <1552402660-31730-8-git-send-email-info@metux.net> (raw)
In-Reply-To: <1552402660-31730-1-git-send-email-info@metux.net>

---
 drivers/tty/serial/zs.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/zs.c b/drivers/tty/serial/zs.c
index b03d3e4..2fd4821 100644
--- a/drivers/tty/serial/zs.c
+++ b/drivers/tty/serial/zs.c
@@ -986,14 +986,13 @@ static void zs_release_port(struct uart_port *uport)
 {
 	iounmap(uport->membase);
 	uport->membase = 0;
-	release_mem_region(uport->mapbase, ZS_CHAN_IO_SIZE);
+	uart_memres_release(uport);
 }
 
 static int zs_map_port(struct uart_port *uport)
 {
 	if (!uport->membase)
-		uport->membase = ioremap_nocache(uport->mapbase,
-						 ZS_CHAN_IO_SIZE);
+		uport->membase = uart_memres_ioremap_nocache(uport);
 	if (!uport->membase) {
 		printk(KERN_ERR "zs: Cannot map MMIO\n");
 		return -ENOMEM;
@@ -1005,13 +1004,13 @@ static int zs_request_port(struct uart_port *uport)
 {
 	int ret;
 
-	if (!request_mem_region(uport->mapbase, ZS_CHAN_IO_SIZE, "scc")) {
+	if (!uart_memres_request(uport, "scc")) {
 		printk(KERN_ERR "zs: Unable to reserve MMIO resource\n");
 		return -EBUSY;
 	}
 	ret = zs_map_port(uport);
 	if (ret) {
-		release_mem_region(uport->mapbase, ZS_CHAN_IO_SIZE);
+		uart_release_memres(uport);
 		return ret;
 	}
 	return 0;
@@ -1113,9 +1112,12 @@ static int __init zs_probe_sccs(void)
 			uport->flags	= UPF_BOOT_AUTOCONF;
 			uport->ops	= &zs_ops;
 			uport->line	= chip * ZS_NUM_CHAN + side;
-			uport->mapbase	= dec_kn_slot_base +
-					  zs_parms.scc[chip] +
-					  (side ^ ZS_CHAN_B) * ZS_CHAN_IO_SIZE;
+			uart_memres_set(
+				DEFINE_RES_MEM(
+					dec_kn_slot_base +
+					zs_parms.scc[chip] +
+					(side ^ ZS_CHAN_B) * ZS_CHAN_IO_SIZE,
+					ZS_CHAN_IO_SIZE));
 
 			for (i = 0; i < ZS_NUM_REGS; i++)
 				zport->regs[i] = zs_init_regs[i];
-- 
1.9.1

  parent reply	other threads:[~2019-03-12 14:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 14:57 RFC: cleaning up the serial drivers and use struct resource Enrico Weigelt, metux IT consult
2019-03-12 14:57 ` [PATCH 1/8] drivers: tty: serial: 8250_bcm2835aux: use devm_platform_ioremap_resource() Enrico Weigelt, metux IT consult
2019-03-12 16:33   ` Greg KH
2019-03-13  6:59     ` Enrico Weigelt, metux IT consult
2019-03-13 11:28       ` Miguel Ojeda
2019-03-13 14:09         ` Enrico Weigelt, metux IT consult
2019-03-13 14:36       ` Greg KH
2019-03-13 17:13         ` Enrico Weigelt, metux IT consult
2019-03-12 14:57 ` [PATCH 2/8] drivers: tty: serial: 8250_dw: use devm_ioremap_resource() Enrico Weigelt, metux IT consult
2019-03-12 14:57 ` [PATCH 3/8] drivers: tty: serial: 8250_ingenic: " Enrico Weigelt, metux IT consult
2019-03-12 14:57 ` [PATCH 4/8] drivers: tty: serial: " Enrico Weigelt, metux IT consult
2019-03-12 14:57 ` [PATCH 5/8] drivers: tty: serial: introduce struct resource Enrico Weigelt, metux IT consult
2019-03-12 14:57 ` [PATCH 6/8] drivers: tty: serial: vt8500: use memres Enrico Weigelt, metux IT consult
2019-03-12 14:57 ` Enrico Weigelt, metux IT consult [this message]
2019-03-12 14:57 ` [PATCH 8/8] drivers: tty: serial: xilinx_uartps: use helpers Enrico Weigelt, metux IT consult

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=1552402660-31730-8-git-send-email-info@metux.net \
    --to=info@metux.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --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