Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3509388ybi; Mon, 29 Jul 2019 07:46:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzw7DjBz12IbfaXWy64POrsk33aD8ZhHWCp1pvP2UsLgkJEorX6iwOceJgETNA4Jy5de85a X-Received: by 2002:a62:5252:: with SMTP id g79mr36432478pfb.18.1564411604916; Mon, 29 Jul 2019 07:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564411604; cv=none; d=google.com; s=arc-20160816; b=Z4K5CFxjN8jCKAvA+NjsH8BM4MCPgCqCytypmF8BK2pGySF2cd3SkZt4xWQYyWiV/C 2NBD9zdrNJ+WHXi2P5jt1rkU7YJZ/q7RSP5WAc6ptpbbpsbc5n+6e89iygkwRskajsLm 1uKofF+zx21kENpGuNcaO3kfBFLyOq4x5DLXmIZrVNuC0PSkunCJ2xBIFRlVy7Dhw2eY g0bjkpV8TUe7D7qqCRHCg25oHfIxeyhtNWDrkCf4tsrFLNqWUCtX9c13OwpIOWOMx033 roVwu+xgVDEpPhy7dUBEp2IdS5phVoLZqkCUtZIqnw1+bTfOgc/ZG8zQW3nFX6So7xsa k3FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=EYuLd5uIdShsD7VZ7Z41SdM7ltZdYB0eyHSQirq931s=; b=hN1CZUxzs5cPLt2/rakQ2qb8FpUSdlcmmAnkP1QG+dJLDLI5JEfJcByiLfxF2MQdOe LmQR1C0RTiZOy9SJBA0kXVsyPbzXfit7hVjLNQBn9/WK6rT4dcqybxfJZet98ha6j+Jn 853N9nF/OBdNDsI1Ia69SjtfSIHRAG+fNEdd4HDFCbt8etoZmz4pjIAbJzoJ8zdcR5jR YgmczbOB01t3LEaWChk15UJH3tfdaFQEIxhPJF6Zfcmm+J7Cm7Q5YygRcum0gvi3wV7U 0lUPNfO6kF8lzEs7OulE6v3oV++TOhzRUpdfGpc9Xy4k4TKMH/UEm8eyOw/pHlELKDac jG4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si24839711plc.356.2019.07.29.07.46.28; Mon, 29 Jul 2019 07:46:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728195AbfG2OoJ (ORCPT + 99 others); Mon, 29 Jul 2019 10:44:09 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:40217 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727579AbfG2OoI (ORCPT ); Mon, 29 Jul 2019 10:44:08 -0400 Received: from orion.localdomain ([77.4.29.213]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M4bA0-1hqSBc3r9S-001lLn; Mon, 29 Jul 2019 16:44:07 +0200 From: "Enrico Weigelt, metux IT consult" To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org Subject: [PATCH] drivers: tty: serial: amba-pl011: use generic ops request/release port Date: Mon, 29 Jul 2019 16:44:05 +0200 Message-Id: <1564411445-26933-1-git-send-email-info@metux.net> X-Mailer: git-send-email 1.9.1 X-Provags-ID: V03:K1:jdPTzVwFCUfxy3QU+2kLmfIUT55orwVaxqJ69PmQw5UfU9KZzDw wql5XfmsTe/VCPW2xY1keE8jypSgxOHsIecar5nuXnHzQo745zmKsI4Zz7zngr6CsGqAOe8 elVBX0FMHSSsUBADOSdUrlqxsfgPWCPRTLejjsm4+BUt+9rL9/bDammMcXAEPhcvjIsumvz awr1hOF+fOYzcBtyX0oIw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:9/NGNk0UAT4=:O+Zbg9s8HYxFwidTY8c++4 hCXMfmBMvffdecKzVGu72HF5tbKcwcWgxJrHbJ46mFcdXOenVp9sbFFXEkjzOzQlDeQocyZAd hHicgGZtqNOLuTVOAwMHYyxPQvxilgkWdesUB8hGhGNb1MolZqameOV+Ag2mh1QC/D+pP/yUa lsZIgi6PGSeZMWE+9MDyzEFyaUkaJ3J5OdsePMRrbuvsuZwl+LVziPdu/3Nmmf6dGE6BHvnhY mGyTUjLpOQ1Qg8Zltw4UKSomZf5e4BtGhmCg1bQ4DwpWOBQozIpECogDmsHF6F9p56FLVVCEx O3l+f1ImxRb6abCb3iRXNo8Z6YSp2stKb37sfKQ7u+SlGZq8Cm08IAHZWqZohhAk2P48HCKzP fmCTeArQIXYdsydsRlyosyQ7jMnId1FAxET84WFyFpLkdEWn8Wcf1dsI4nzPUX4HruVKYQu9O PZX8bkzA3htkoBGCdfaJlypqpVVPyGCPDlBK241cltAe9Rlf+UIOT1c1Bjqlzk+IPUSiDaVum L/cTv5aQEDcPZ8qogoEQ0zD8KokMxPN9NCD/M4dm3z7ax6lg+3IDrwoI77SbHIcOTBmcRgL32 gXAKRBIEfve2IopX9SPZW+jtLq5m4IuAR4p50GFruPWyhzRJCwtpMrAAPkTGQ71e9vVag+LGr C8ab6EF4qllV7Y8d7t1KoAuexqYfK0/gvzSpDl5QpKq5qFEx02QMtDL5cEfr6lcAUnavSkZtN HQbdaBonZMWd9XpBJ+k6V3v7YRFeh28PF+EvDw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Enrico Weigelt Reduce boilerplate by using generic implementation of the trivial request_port/release_port operations. For that to work, we have to set the mapsize field accordingly. --- drivers/tty/serial/amba-pl011.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 5921a33..6b7c3c7 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2094,30 +2094,13 @@ static const char *pl011_type(struct uart_port *port) } /* - * Release the memory region(s) being used by 'port' - */ -static void pl011_release_port(struct uart_port *port) -{ - release_mem_region(port->mapbase, SZ_4K); -} - -/* - * Request the memory region(s) being used by 'port' - */ -static int pl011_request_port(struct uart_port *port) -{ - return request_mem_region(port->mapbase, SZ_4K, "uart-pl011") - != NULL ? 0 : -EBUSY; -} - -/* * Configure/autoconfigure the port. */ static void pl011_config_port(struct uart_port *port, int flags) { if (flags & UART_CONFIG_TYPE) { port->type = PORT_AMBA; - pl011_request_port(port); + uart_defops_request_port(port); } } @@ -2150,8 +2133,8 @@ static int pl011_verify_port(struct uart_port *port, struct serial_struct *ser) .flush_buffer = pl011_dma_flush_buffer, .set_termios = pl011_set_termios, .type = pl011_type, - .release_port = pl011_release_port, - .request_port = pl011_request_port, + .release_port = uart_defops_release_port, + .request_port = uart_defops_request_port, .config_port = pl011_config_port, .verify_port = pl011_verify_port, #ifdef CONFIG_CONSOLE_POLL @@ -2181,8 +2164,8 @@ static unsigned int sbsa_uart_get_mctrl(struct uart_port *port) .shutdown = sbsa_uart_shutdown, .set_termios = sbsa_uart_set_termios, .type = pl011_type, - .release_port = pl011_release_port, - .request_port = pl011_request_port, + .release_port = uart_defops_release_port, + .request_port = uart_defops_request_port, .config_port = pl011_config_port, .verify_port = pl011_verify_port, #ifdef CONFIG_CONSOLE_POLL @@ -2584,6 +2567,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, uap->port.dev = dev; uap->port.mapbase = mmiobase->start; uap->port.membase = base; + uap->port.mapsize = SZ_4K; uap->port.fifosize = uap->fifosize; uap->port.flags = UPF_BOOT_AUTOCONF; uap->port.line = index; -- 1.9.1