From patchwork Mon Oct 21 06:43:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Sain X-Patchwork-Id: 13843673 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A35BD3DEA1 for ; Mon, 21 Oct 2024 06:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=qik9MUkvjO6JV1rMp/RTrgtyZTafWO0tc1hXwQ8xsYk=; b=jowQuMKlJqq7j7wcplKmEhuzi2 /3WwAtEEhZ+9PwuNzpsATkd/zwmDLL8oae88/6zhJT/XNmRhw7eO1ETHwmnWfneLf2anNWpFWlsuX /xanFL98OwMFkbcoVJ0o6daatzAj2D7JS1AkZeysjsdIu2gyYdqS6EX9241Ie+LnlyqTjMFeINKc/ l2CCHtNnTKDMotRekyX23djT6du45WIJoDTdyk91l08EtyQWM22vibeDbKXL/MnOvebGoB32TwAtD 1kF+Epx+Y6mm32T+O8AsbYWSJ7/OdOpj7L+4eOODUoaeQU0KOgzATz11nUHo54xbYNadQoDPeDNu4 ypieqljg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2mDm-00000006GMw-2Gue; Mon, 21 Oct 2024 06:48:54 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2m95-00000006Ez3-0hNp for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 06:44:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1729493042; x=1761029042; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=yjd+fqelGYJuRa6KsIo04zhW9f3/9LxbbAlWVSzv/cg=; b=IrBdWlvHb+izCCl4ioc4LHrKhBhdPviuzUHBgNT4KKj+5hYK2p7RgFVK HRyxfJzj97FuztFdqWg3VVx+FS5XvrEOD3uW20aIprrxo+1k7mJ6E2BMn GbD3QgwKRPronOqQdRT90nx2TS2R7vhkfiaxaVySip9/u1/z1H4b8/VEx qUghObKBXFKr7yk/CwIlxCcMfp68+Qpd014I6KFtGnj19CRkJMog/Z84i XsHD9jRmJTWe72hqEEMexuxI1AuoJQ+OG3wbhNCbTzUOaRvd194vfq4j4 E75iEs0moaEjYaslculZDabmZoWbRZV0rrCRwiqleGpFxLsE34YeDcUJ9 A==; X-CSE-ConnectionGUID: prXNASNtSEGI7fl1Bae9BQ== X-CSE-MsgGUID: VYjXu8agQeOmUhYFhm1Ywg== X-IronPort-AV: E=Sophos;i="6.11,220,1725346800"; d="scan'208";a="33047165" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 Oct 2024 23:43:59 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 20 Oct 2024 23:43:54 -0700 Received: from archlinux.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Sun, 20 Oct 2024 23:43:52 -0700 From: Mihai Sain To: , , , , , , , , CC: Mihai Sain Subject: [RFC PATCH] tty: atmel_serial: Use devm_platform_ioremap_resource() Date: Mon, 21 Oct 2024 09:43:21 +0300 Message-ID: <20241021064321.3440-1-mihai.sain@microchip.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241020_234403_359163_C632C4D6 X-CRM114-Status: GOOD ( 11.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- drivers/tty/serial/atmel_serial.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) base-commit: 42f7652d3eb527d03665b09edac47f85fb600924 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;