Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030237AbbKDAVR (ORCPT ); Tue, 3 Nov 2015 19:21:17 -0500 Received: from mail-bn1on0059.outbound.protection.outlook.com ([157.56.110.59]:62624 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932673AbbKDAVL (ORCPT ); Tue, 3 Nov 2015 19:21:11 -0500 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; From: Soren Brinkmann To: Greg Kroah-Hartman , Jiri Slaby CC: Michal Simek , , , , "Soren Brinkmann" 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 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11HUB023;2:DRwM4byfqpqjsuns6tRMpsFzGabXlC2//tb6lvqBKkDzSAV3jtcDDsUn6gYgkz1tiSF4HRE6t8N9JAvxhMiyJwERlipjaNC9Bd7hvsEE9eHhHvCK7NF2YKs/r11ivZe8684W5KBhXA9GTZh+Y2H3zDUfBCO69XCivfj3d0fxo98=;3:LH6qrwqqZokz8lflukpHvDvMrP4Wre+ly/m2TJKc/PmHV4KwSwCWhhCUJ1kQy9d33xP8FbjSRn3XGVbTgcpxcaZ7sZt0Xtg1G2yGkEXlLTlhaIFh0GjUvaluXlATuY4dnGx6axObLXmOYg36SFjPlzQg6yjSr9mjDx+0Si9FwgnWhlc6HRqgzblRURhr/+FaAV0qoOcimNAWH2qy9RPo2zWN1ini4W0dnGqRnpdOyo82rXBYjFAFS/xAYsx6i2lJDNA9MKSPVQV8MuEQBHNjBQ==;25:bRDkuVoGa42lC9p3FSWPYAx/YjCvmUiN67U4SJ3eKEve8Lk5k3e+VRWDl0ru/YKsYGB0ak9anLxt/oW2NM3DDoOWtzrHNuL979iBP9skyRvZLOp1VoW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qvy/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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2889 Lines: 94 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) { -- 2.6.2.3.ga463a5b -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/