summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/atmel_serial.c
diff options
context:
space:
mode:
authorMihai Sain <mihai.sain@microchip.com>2024-11-05 15:19:46 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-07 09:45:18 +0100
commit785cbc8b790687859452513acd08964e69795afc (patch)
tree3af855b401cba8dd7633378ceb5e2ef5951d9442 /drivers/tty/serial/atmel_serial.c
parentbcc7ba668818dcadd2f1db66b39ed860a63ecf97 (diff)
downloadlwn-785cbc8b790687859452513acd08964e69795afc.tar.gz
lwn-785cbc8b790687859452513acd08964e69795afc.zip
tty: atmel_serial: Use devm_platform_ioremap_resource()
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> Tested-by: Andrei Simion <andrei.simion@microchip.com> Reviewed-by: Hari Prasath Gujulan Elango <hari.prasathge@microchip.com> Link: https://lore.kernel.org/r/20241105131946.22449-1-mihai.sain@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/atmel_serial.c')
-rw-r--r--drivers/tty/serial/atmel_serial.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index b9be993ebdf4..6af70c7ddbe5 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;