From: Mihai Sain <mihai.sain@microchip.com>
To: <richard.genoud@bootlin.com>, <gregkh@linuxfoundation.org>,
<jirislaby@kernel.org>, <nicolas.ferre@microchip.com>,
<alexandre.belloni@bootlin.com>, <claudiu.beznea@tuxon.dev>,
<linux-kernel@vger.kernel.org>, <linux-serial@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<hari.prasathge@microchip.com>
Cc: Mihai Sain <mihai.sain@microchip.com>
Subject: [PATCH] tty: atmel_serial: Use devm_platform_ioremap_resource()
Date: Tue, 5 Nov 2024 15:19:46 +0200 [thread overview]
Message-ID: <20241105131946.22449-1-mihai.sain@microchip.com> (raw)
Simplify the request port function by using a single call
to devm_platform_ioremap_resource().
This will also enhance the printing from /proc/iomem:
cat /proc/iomem | grep flexcom ; cat /proc/iomem | grep serial
f0004000-f00041ff : f0004000.flexcom flexcom@f0004000
f8020000-f80201ff : f8020000.flexcom flexcom@f8020000
f0004200-f00043ff : f0004200.serial serial@200
f8020200-f80203ff : f8020200.serial serial@200
fffff200-fffff3ff : fffff200.serial serial@fffff200
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
---
drivers/tty/serial/atmel_serial.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 09b246c9e389..e1107f14ec98 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2419,17 +2419,11 @@ static void atmel_release_port(struct uart_port *port)
static int atmel_request_port(struct uart_port *port)
{
struct platform_device *mpdev = to_platform_device(port->dev->parent);
- int size = resource_size(mpdev->resource);
-
- if (!request_mem_region(port->mapbase, size, "atmel_serial"))
- return -EBUSY;
if (port->flags & UPF_IOREMAP) {
- port->membase = ioremap(port->mapbase, size);
- if (port->membase == NULL) {
- release_mem_region(port->mapbase, size);
- return -ENOMEM;
- }
+ port->membase = devm_platform_ioremap_resource(mpdev, 0);
+ if (IS_ERR(port->membase))
+ return PTR_ERR(port->membase);
}
return 0;
base-commit: 2e1b3cc9d7f790145a80cb705b168f05dab65df2
--
2.47.0
next reply other threads:[~2024-11-05 13:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 13:19 Mihai Sain [this message]
2024-11-05 13:31 ` [PATCH] tty: atmel_serial: Use devm_platform_ioremap_resource() Andrei Simion
2024-11-06 8:13 ` Hari.PrasathGE
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=20241105131946.22449-1-mihai.sain@microchip.com \
--to=mihai.sain@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=gregkh@linuxfoundation.org \
--cc=hari.prasathge@microchip.com \
--cc=jirislaby@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=richard.genoud@bootlin.com \
/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