Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161921AbbKEHVs (ORCPT ); Thu, 5 Nov 2015 02:21:48 -0500 Received: from mail-bn1bon0064.outbound.protection.outlook.com ([157.56.111.64]:39952 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032389AbbKEHVh (ORCPT ); Thu, 5 Nov 2015 02:21:37 -0500 Authentication-Results: spf=pass (sender IP is 149.199.60.100) 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 v2 08/10] tty: xuartps: Move RX path into helper function Date: Wed, 4 Nov 2015 23:21:17 -0800 Message-ID: <1446708079-1105-9-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.6.2.3.ga463a5b In-Reply-To: <1446708079-1105-1-git-send-email-soren.brinkmann@xilinx.com> References: <1446708079-1105-1-git-send-email-soren.brinkmann@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21920.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD021;1:PbfKCuH8eouO3aBflQ5MoEoE9LPtpEOhLdA1k6szvXTOy+Wk3P7Z4BUulKJLbBrDnLR2I6IHitoHPoXMPwLWioalyEXgWru+zzXQ57Xkw9tdamjg50WO0Fai8laKdmRxh7BxjGz1c375fsDhoCpkp3UZejemCpIBm4gMv/RIMGvAK7GUgy+4T69vh+gt/SUtV0HcGbd97IN05K8iWiWtSpadHI5SSBhXg4qHR6E37FbsVK270XMrZcJHKslqu/U3dcJUTcgs0759yQUWowtS2fjG+1CBYcX72C2JI//rCaUe1ylZmuFnmMnEDClFqtexUnpxEWjVfY2OxY6X6SpL1HJ5+c6qLddX1jSAKYYzWbc= X-Forefront-Antispam-Report: CIP:149.199.60.100;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(189998001)(19580395003)(5001770100001)(57986006)(6806005)(5003940100001)(87936001)(33646002)(229853001)(106466001)(86362001)(36386004)(81156007)(5008740100001)(11100500001)(92566002)(5001960100002)(5007970100001)(50466002)(76176999)(36756003)(16796002)(107886002)(76506005)(48376002)(4001430100002)(63266004)(50986999)(47776003)(77096005)(2950100001)(19580405001)(50226001)(107986001)(5001870100001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN1BFFO11HUB047;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11HUB047;2:oh52j+PM4CoB8AyBCG7ZHJDFL/24LWABW7yEbddLQ421P7C5el/5FtSTyDac+bEaHjthnbx9rh3/4p6cAW0/FrO62hawnardp/B08LAY5E5TJigK/E7m/xSIqto2MXgD0WquRsTD4DkbvQILEcgpII75UcToBQHkivik2WC3Oeo=;3:ha/H76oib8Dlce7E1R7bEBEFI6/69IsRq2UPeWMecqpR3yjY/C3mycQeSNFQa9Y85Z6dzCuYYQfW/Hkv9mUwzPdLp0VIXdb55DCI6GwywCQDKqG/AzbAxvE88g8T3k6OzSoQFcqM6y8mRxySleyyiVN3E+ZGfsO5DoR+HcXcSdft8Jaaj4G9GAclElfNtKwZA1ILe7lPxeY8ZpiXHUIrFOUylu3eG+8EverJ8XsuR1LGmdHOYkt5duCwbrhek+3vrHC8cZMo+OGvPbuCnO2xsQ==;25:QHnc+/voX7NLAhvdQvmeulmOYNymLmHLmdOecOjkxt69TbG/lK92zg/tR1Aeqm3DDlZQcir/cZXWT0HO/eTsdkQVsRW0fxwnCYubjLGaRDT3jkO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WF4acshwaibwDhP8HClX8L4ZRqnnjlKCKf969BBOLsqTHRDAB7+/XF9w2hqPSOYCRNG2xMG8M01/ffQQgBErbRIns2FMv0l 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)(3002001)(10201501046);SRVR:BN1BFFO11HUB047;BCL:0;PCL:0;RULEID:;SRVR:BN1BFFO11HUB047; X-Forefront-PRVS: 0751474A44 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN1BFFO11HUB047;23:IgDb61nD//AVFKwodltsLK2SK3FtViWJ3sCo52e?= =?us-ascii?Q?N0Nsi3KRSQ9DlY3VKsh4+Q2vKhzz9NUn6ONgrTlRDnfH1Kk+cIKMHV9qatkL?= =?us-ascii?Q?QIU5NopTfaXliZjpZoMDyG3dRZX/lOCpkR6iq9FWBEpv7zl46S1pxYtaLG0J?= =?us-ascii?Q?5xal1j6xhWCnemVc9yWxS9ZiGUXFByww2+zvgJUjB4tNa5KAeSat696PMBGb?= =?us-ascii?Q?koypz5NFhdhq184RLVO7yDxaheK3ZUmTv9iQTYwTsToINdmgP17eEqghs8qd?= =?us-ascii?Q?tf6rfE+velxiYx/g87XzG0gL0vwj8iQLMdYKhZOfSgYwHWjSzwNIhwDn03dt?= =?us-ascii?Q?54RNs/XFy6jAOLz7/ZN5m6j3fJr4x9cN4Ijf1qQmWABZZpNzWw27kGGMRuOG?= =?us-ascii?Q?t+frSaooGmFO1OmhQsFetNaGbTdsMLpom8c83QumSE0y04iH/4yX5/K3RS93?= =?us-ascii?Q?R+7WS0WeX2/yJC7Hc8R7xmmroUQqN0z7bx6D3Aqj6JvizW1fUElbYEgoYPUC?= =?us-ascii?Q?m/xO3vOAQevB+qO+o4vagMX3gAmVoBIDAaKajyqtS3UhoV18lyYeAlExjNFP?= =?us-ascii?Q?zWTQVrdjvsY7XtS40DOCHd/eFz3zOX0t2VSy1nMLL0Q+JyP5q8TqRNyoT7ay?= =?us-ascii?Q?SQ+razetWC+FZ9NTz5t7K3giN2516pySNkMoaFNl1penIJg0ZqzcNMGASgOb?= =?us-ascii?Q?Mk8cKLnBVJ77FpHdJrak6jnaDXnADGOg6E/UJLn45IBmA4i9rKQ2EY9lG9GK?= =?us-ascii?Q?w17narMhpeMgE/q7vP7bCJ1DJp7m2Q+8GZfFbSIUQibD93NOvZ+yU8phJ7og?= =?us-ascii?Q?p6HyNVdxkPXjYj9Q1A/WiKawvPT+zg+WZCtdQeyQyKQPYZuEYHwHM+TI+kvY?= =?us-ascii?Q?rqaeFdGbXZPwjPWn/zjAIfW/ThAVc+DqNQZWRXU9ctxmUbun92huaRSWpetH?= =?us-ascii?Q?NmTMhGbUD730jCwXdO5+SBgTb5nXCl/18m5UotsCJY08gpZ69ctiMe4gi4Zs?= =?us-ascii?Q?TZe7i6RUfbD6Xb8NmKB127i43Ew6nYp6+XcGBJ1lp+AWrYdEztOCaw3bjEmA?= =?us-ascii?Q?TKUwTbjGlKKqX/leTMTl3nq3mAZAHLj86FlRgUzG4rCeECplxODGS8OuVQc6?= =?us-ascii?Q?6AIrhTmRwgNg=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11HUB047;5:BhN5NxHTbMP5rq5tIYhhRhbq3PF0hF1Js02PstERmquvDfCYXbvRIeLIdj2d3FvDRGya9QJc7Otr3LiqYW2ElS32eA4A1BNpzNz42qzWbCV7cnblQHZD/Y+TgtJnn3h0C2VfV+OY/BvSkfgQ4UdHdg==;24:jUXJSkLjplIjXQ7klAuCaWNgDmLjeU9PVMZKg2Ku7y3e5rxpXwAmmRJIcSRbuhnjK4k0Hw29K98Qi+5G471VMuqqC1DOFBs56P78IHBcD68= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2015 07:21:35.1097 (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.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1BFFO11HUB047 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 7fd226d65496..aa1176e6661a 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/