From patchwork Wed Nov 4 00:20:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soren Brinkmann X-Patchwork-Id: 7547661 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3955FBF90C for ; Wed, 4 Nov 2015 00:24:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59C2620792 for ; Wed, 4 Nov 2015 00:24:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6EE0A2078E for ; Wed, 4 Nov 2015 00:24:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ztlpk-0001OQ-7B; Wed, 04 Nov 2015 00:21:48 +0000 Received: from mail-bl2on0075.outbound.protection.outlook.com ([65.55.169.75] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtlpS-0001Hg-Ah for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2015 00:21:31 +0000 Received: from BL2FFO11OLC015.protection.gbl (10.173.160.32) by BL2FFO11HUB023.protection.gbl (10.173.161.47) with Microsoft SMTP Server (TLS) id 15.1.318.9; Wed, 4 Nov 2015 00:21:08 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2FFO11OLC015.mail.protection.outlook.com (10.173.160.81) with Microsoft SMTP Server (TLS) id 15.1.318.9 via Frontend Transport; Wed, 4 Nov 2015 00:21:07 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1Ztlp4-0006PB-Tf; Tue, 03 Nov 2015 16:21:06 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1Ztlp4-0006aj-En; Tue, 03 Nov 2015 16:21:06 -0800 Received: from [172.19.74.49] (helo=localhost) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1Ztlox-0006Ul-NE; Tue, 03 Nov 2015 16:20:59 -0800 From: Soren Brinkmann To: Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH 8/9] tty: xuartps: Move RX path into helper function Date: Tue, 3 Nov 2015 16:20:49 -0800 Message-ID: <1446596450-20918-9-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.6.2.3.ga463a5b In-Reply-To: <1446596450-20918-1-git-send-email-soren.brinkmann@xilinx.com> References: <1446596450-20918-1-git-send-email-soren.brinkmann@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21918.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC015; 1:0RB2nrFY//9/XNgGsTGxqO4eGHNbNk6ptXAfEIsqQbxkvacAIusONEYWn9vDlqY797COpYGQRq39HEAs6MC8hV98kCUZUXES9Xi/UhKyMTzH5g8usGhyYS3kMsE9J1wphwfpyM9uC9B2MEbDsTMeRy3I80/XhXM0KdlntxFA2IqFYSf4+iO2jAFrDhqWKeb9Cr/9oH+9mGIGXfXkt0Li5BUotYnBvahK1oTJnJJ9DjPsRXXjuOtVMB3c0hELwmwk+mArnDwgufnjkZHDcKI5fgeC4t0Vp9kKghC7mWIE6BxHG16kuPZTBWuOCnNOorRNz+BqGpQ8+dTLbU8QRuQTnLEmExaXv6LbdK7bZwYCTTg= X-Forefront-Antispam-Report: CIP:149.199.60.83; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(16796002)(4001430100002)(76506005)(5001770100001)(107886002)(229853001)(19580395003)(77096005)(2950100001)(36756003)(50986999)(189998001)(92566002)(76176999)(87936001)(57986006)(5001960100002)(36386004)(106466001)(48376002)(81156007)(50466002)(33646002)(63266004)(5003940100001)(86362001)(19580405001)(6806005)(50226001)(5008740100001)(5007970100001)(11100500001)(47776003)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2FFO11HUB023; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11HUB023; 2:DRwM4byfqpqjsuns6tRMpsFzGabXlC2//tb6lvqBKkDzSAV3jtcDDsUn6gYgkz1tiSF4HRE6t8N9JAvxhMiyJwERlipjaNC9Bd7hvsEE9eHhHvCK7NF2YKs/r11ivZe8684W5KBhXA9GTZh+Y2H3zDUfBCO69XCivfj3d0fxo98=; 3:LH6qrwqqZokz8lflukpHvDvMrP4Wre+ly/m2TJKc/PmHV4KwSwCWhhCUJ1kQy9d33xP8FbjSRn3XGVbTgcpxcaZ7sZt0Xtg1G2yGkEXlLTlhaIFh0GjUvaluXlATuY4dnGx6axObLXmOYg36SFjPlzQg6yjSr9mjDx+0Si9FwgnWhlc6HRqgzblRURhr/+FaAV0qoOcimNAWH2qy9RPo2zWN1ini4W0dnGqRnpdOyo82rXBYjFAFS/xAYsx6i2lJDNA9MKSPVQV8MuEQBHNjBQ==; 25:bRDkuVoGa42lC9p3FSWPYAx/YjCvmUiN67U4SJ3eKEve8Lk5k3e+VRWDl0ru/YKsYGB0ak9anLxt/oW2NM3DDoOWtzrHNuL979iBP9skyRvZLOp1VoWkw0ShvONhkOnoc0DxEBOS4jdHRPnzP9wapKqVXA/qmDzy4vao+SZOIDScPRs9jOUWSpWkZnI+rqJuChb6iT2ECEiNWMNKa2PIWCYjMjzTkvMPhpl8pZJFBilsNC+rtL0s9EAVCN9W2PEz1MHw+nWt/vjKQebVQvE/tw== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BL2FFO11HUB023; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11HUB023; 20:LJKObqOeyOJrGAVOk8GW2tS2ByC+KWXWhUfFtGS9GYyoLIRd+cPPcEvIB/A+N1D1GNirLAXahX+fX37Vn2uMXj24x/eAB6NKPl8yL4R0rfM3suK39L32qaZGYjgo0tj+KXvER6jDzFSMzSAxJ91/mkKpKmh1DlpusFzA9BkdVLjRh7gSSfI4D1IVwNZqMzNPTqPQrpcWfNw90BzT7mKkpQCV+xzCG9WE7alNT+8RGEdwsVvZD6foH5iC0zxPgUfbcagFW6laNU4UChsew4x139Fcq3rIZf1E8QcbNQV7qXP88ZAwfh9ZokgU2YMrG+CFGKWFFAWu1OL65yOfqZwked70clRhyUIAOda6pac1GulukCcPklEev0QKuBGfdgX5+b2sfzChsAGBVz7P7t8SQ7b9GPgbfx79URWC73joONABdamrVBa7ElDRaq7v5WtnKfLjMVokVc9XArGUPpXMTRHorDbI9Vx1M5wjZwb5NxRzFTIkqNMGmZ6CzOo7FEY4; 4:cntxX+JAdTGthXX/+9q31agg8iqnmzGKh6N+R3Q3qaI2A1PkGi7AH8UtFKdTqKcGKgnldMJFYVpk8KxyrPikOBz6+hT1FcE7fi+mRlwob7YqHrEH6N/LptyB7WHKsYKopuXmL7QhdxLqLP06lGhdtOJbQyhQyLaKA8RzlgMOxMq+jh09GN71towD6nmJO9pqS1P7zimMOOz3dVYibru0Wx/y/5zCWAetE+O4QPE2h5bmGGFnkEbxXF7TgMegw8/oGDkyvUFHlvDzGUi5GhT3ZTBLDBUMCRVS9LGRqkXRzu9/Io3OoO6Qvy/V0jsg2axE5Air6LwKfU5hoInBIO75Q6UBrTjtzb5xCkFURPii5mUS6/caZz/kqZm49N1hbylf X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(10201501046)(3002001); SRVR:BL2FFO11HUB023; BCL:0; PCL:0; RULEID:; SRVR:BL2FFO11HUB023; X-Forefront-PRVS: 0750463DC9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2FFO11HUB023; 23:3tQU83aMDmNrqFhVMQaOs8ZLa+ef/HCApFtllwaU?= =?us-ascii?Q?SSWcKlTc0kRxemK7O2clI41josQyfuSOdhs7xEPGa5PQMZk4/Egaq3kq5gkc?= =?us-ascii?Q?ZTf4b6vFKmp/WW1X8h/B1+QTapxdWQhrBr1sLOAuX8DCw1dvA/+H+whfooe9?= =?us-ascii?Q?hvUkyKhQxsDQ0MZGLm/pb/tBwe2nDuSuicfeidV62QcaW07zrROQALMBUQA5?= =?us-ascii?Q?RHZXUiqtB6/5wyz4OnWVFbZDAbQ4GcC07vy8goT9co9bLXdlN38WsBCHC50q?= =?us-ascii?Q?zS9qx/GL2OQk4+JF/bsxi/VphYmCzTpoFgyGU3WAldDcDDmjQzK3G0OiEM/s?= =?us-ascii?Q?IuFIpzOtu3LM9NcEIfpstdnW1TdmPesrrc4Sh2e2QTykmXBIJ9y2R5eTQmtx?= =?us-ascii?Q?cUO4eGBus1ahQQ50L9pI0pPSD5VixAXUWIVzIZ1b/kJ7HWkAtnnJA3JpiZo0?= =?us-ascii?Q?kafpbP5OdrEiV67xmeg2cxxjtZAchT9Nh3eeouA56ll0sE7mbqMAaitLEX/4?= =?us-ascii?Q?dUHBs7x8hxOo9ogTfjlIKVJlw+rqwhvi41tFGV2H/7OArDgfglu3RnJAMxjm?= =?us-ascii?Q?XZvqL8BUUHX4sA8zbEZDImbOReuYSjbT6T8dg74SxFmoXMtONpf6GGn73g/H?= =?us-ascii?Q?0dykqMGMpzWulObpKi3cyR7DWhcfjqCx/reSq1IzTSWuutzRJGmiOvWGYasR?= =?us-ascii?Q?R971AFZjrKIxieatgmLNN67zgS3e8ZDv8jZvlq1mof9065q4O0txFJycRlhD?= =?us-ascii?Q?oxmqkuCG7VNXr+xdfh0Motz+IKJP7pF5eU6bCmxKpl/KZfmZhUcBaLB5LnzM?= =?us-ascii?Q?1I9t4BzW4Bs17ehtTMjaOYdpweArf1FZT0amsSUHrGZHNIOT9RrTSPQfbPkR?= =?us-ascii?Q?hfjf902T9a6E64O+M4Uxqiqqd3+gEmkcpbV/pL9Vt//vm37ewVE6PLee1dVZ?= =?us-ascii?Q?zY5HLBUr9Q6VOious/aA9oXFzKU6qV71aBHXxjTaipmy3XtA0XJcbJOulJPN?= =?us-ascii?Q?Dk9hLIA83zygL3An81vztVG82evEMPgQt3+dNG41znCX2SgYtj7GRnCEWR6i?= =?us-ascii?Q?dfSHMOfBA9a7+5lEy8RRruLgku5w?= X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11HUB023; 5:bFw3olXsT6H0IwOQJXjyT22VLoaTNIEsk45FE5ncp9+Rs2wC0zdJmbz2X1cUJaGhUbfpgodMPHnIEuN4IEF0ZaYfAk8rPiopc64OIwaxoq5aFF/3RB4F5fizM6tta39ePHCYeioRKAvmrT2bsCym7Q==; 24:19TqK2lBJL92L0OoeNd/4BSAWzyUbWZVsyjRlYpNTpSt/6BVjh9u9dr8CrOjhKjJwEHV0X2/ywxRDdPoMO7tqCtbc9ifxr8vVT83uJt7ewo= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2015 00:21:07.6686 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2FFO11HUB023 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151103_162130_591719_5E7B164F X-CRM114-Status: GOOD ( 12.90 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Soren Brinkmann , Michal Simek , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move RX-related IRQ handling into a helper function. Signed-off-by: Soren Brinkmann --- drivers/tty/serial/xilinx_uartps.c | 50 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 4904eec37621..149868cc003c 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -172,28 +172,8 @@ struct cdns_uart { #define to_cdns_uart(_nb) container_of(_nb, struct cdns_uart, \ clk_rate_change_nb); -/** - * cdns_uart_isr - Interrupt handler - * @irq: Irq number - * @dev_id: Id of the port - * - * Return: IRQHANDLED - */ -static irqreturn_t cdns_uart_isr(int irq, void *dev_id) +static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) { - struct uart_port *port = (struct uart_port *)dev_id; - unsigned long flags; - unsigned int isrstatus, numbytes; - unsigned int data; - char status = TTY_NORMAL; - - spin_lock_irqsave(&port->lock, flags); - - /* Read the interrupt status register to determine which - * interrupt(s) is/are active. - */ - isrstatus = readl(port->membase + CDNS_UART_ISR_OFFSET); - /* * There is no hardware break detection, so we interpret framing * error with all-zeros data as a break sequence. Most of the time, @@ -223,6 +203,9 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) /* Receive Timeout Interrupt */ while (!(readl(port->membase + CDNS_UART_SR_OFFSET) & CDNS_UART_SR_RXEMPTY)) { + u32 data; + char status = TTY_NORMAL; + data = readl(port->membase + CDNS_UART_FIFO_OFFSET); /* Non-NULL byte after BREAK is garbage (99%) */ @@ -263,10 +246,33 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) } uart_insert_char(port, isrstatus, CDNS_UART_IXR_OVERRUN, - data, status); + data, status); } tty_flip_buffer_push(&port->state->port); } +} + +/** + * cdns_uart_isr - Interrupt handler + * @irq: Irq number + * @dev_id: Id of the port + * + * Return: IRQHANDLED + */ +static irqreturn_t cdns_uart_isr(int irq, void *dev_id) +{ + struct uart_port *port = (struct uart_port *)dev_id; + unsigned long flags; + unsigned int isrstatus, numbytes; + + spin_lock_irqsave(&port->lock, flags); + + /* Read the interrupt status register to determine which + * interrupt(s) is/are active. + */ + isrstatus = readl(port->membase + CDNS_UART_ISR_OFFSET); + + cdns_uart_handle_rx(port, isrstatus); /* Dispatch an appropriate handler */ if ((isrstatus & CDNS_UART_IXR_TXEMPTY) == CDNS_UART_IXR_TXEMPTY) {