From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751907AbbIKGp5 (ORCPT ); Fri, 11 Sep 2015 02:45:57 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:12796 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751274AbbIKGpy (ORCPT ); Fri, 11 Sep 2015 02:45:54 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-ce-55f2789f6ae4 Message-id: <55F2789E.8010300@samsung.com> Date: Fri, 11 Sep 2015 08:45:50 +0200 From: Robert Baldyga User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-version: 1.0 To: Krzysztof Kozlowski , gregkh@linuxfoundation.org Cc: jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, m.szyprowski@samsung.com Subject: Re: [PATCH v2 4/4] serial: samsung: Fix UART status handling in DMA mode References: <1441892476-14273-1-git-send-email-r.baldyga@samsung.com> <1441892476-14273-5-git-send-email-r.baldyga@samsung.com> <55F26FBE.3060500@samsung.com> <55F27595.1080609@samsung.com> <55F2760B.2000600@samsung.com> In-reply-to: <55F2760B.2000600@samsung.com> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrHLMWRmVeSWpSXmKPExsVy+t/xy7rzKz6FGkx6oWzRvHg9m8WUDR+Y LF6/MLS4vGsOm8WZxb3sFmuP3GV3YPPYP3cNu0ffllWMHuu3XGXx+LxJLoAlissmJTUnsyy1 SN8ugSvjZxdXwU3pig8n+xgbGF+IdTFyckgImEj0H9nEDmGLSVy4t56ti5GLQ0hgKaPExqUN 7BDOM0aJBXMusYJU8QpoSSybfxfMZhFQlehYdZIJxGYT0JHY8n0CI4gtKhAhsXz1SUaIekGJ H5PvsYDYIgK+Ejcn3AWzmQWyJT42LwOyOTiEBYIlvq9Nhtj1iFGi+dAMsPmcAtoSXb1fWUFq mAX0JO5f1IJolZfYvOYt8wRGgVlINsxCqJqFpGoBI/MqRtHU0uSC4qT0XEO94sTc4tK8dL3k /NxNjJBQ/rKDcfExq0OMAhyMSjy8FqqfQoVYE8uKK3MPMUpwMCuJ8BrIAYV4UxIrq1KL8uOL SnNSiw8xSnOwKInzzt31PkRIID2xJDU7NbUgtQgmy8TBKdXAaDFbMb6D8c5n/SAtYe/CU+4W Ve/emVyYXC/CqLSBOb1aVfprrI8Vu2GiV1Piv8nz2kQ2Zc7jXpcypXZm/K55yzq/HD5U9Ng5 IOpZckNrd/yZDcFnzzZId3O+L/y0QVBkJqvG3u7k6vmfTv+8vsCkaNbujO+su2Pvlq3Zcrqi sWLzig5HHq1aJZbijERDLeai4kQAqq7Zj2ECAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/11/2015 08:34 AM, Krzysztof Kozlowski wrote: > On 11.09.2015 15:32, Robert Baldyga wrote: >> On 09/11/2015 08:07 AM, Krzysztof Kozlowski wrote: >>> On 10.09.2015 22:41, Robert Baldyga wrote: >>>> This patch fixes UART status handling in DMA mode. >>> >>> I don't see any changes here. You did not respond to my comment neither. >>> >>> Code looks itself good... except a locking issue but I don't know what's >>> the cause. It may be not related to the patchset and maybe just not all >>> of issues are fixed yet. Anyway I'll describe it in 3/4. >>> >>> Best regards, >>> Krzysztof >>> >>>> For this purpose we >>>> use s3c24xx_serial_rx_drain_fifo() instead of uart_rx_drain_fifo(), which >>>> does the same thing plus checks for special conditions (such as 'break'). >>>> >>>> Thanks to this we have, for example, Magic SysRq handling, which was >>>> missing in DMA mode so far. Since we can use UART in DMA mode as serial >>>> console, this is a quite important improvement. >>>> >>>> This change additionally simplifies RX handling code, as we no longer >>>> need uart_rx_drain_fifo() function, so we can remove it. >>>> >>>> Reported-by: Marek Szyprowski >>>> Signed-off-by: Robert Baldyga >>>> --- >>>> drivers/tty/serial/samsung.c | 30 +++--------------------------- >>>> 1 file changed, 3 insertions(+), 27 deletions(-) >>>> >>>> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c >>>> index 1d7dd86..d72cd73 100644 >>>> --- a/drivers/tty/serial/samsung.c >>>> +++ b/drivers/tty/serial/samsung.c >>>> @@ -385,32 +385,6 @@ static void s3c24xx_uart_copy_rx_to_tty(struct s3c24xx_uart_port *ourport, >>>> } >>>> } >>>> >>>> -static int s3c24xx_serial_rx_fifocnt(struct s3c24xx_uart_port *ourport, >>>> - unsigned long ufstat); >>>> - >>>> -static void uart_rx_drain_fifo(struct s3c24xx_uart_port *ourport) >>>> -{ >>>> - struct uart_port *port = &ourport->port; >>>> - struct tty_port *tty = &port->state->port; >>>> - unsigned int ch, ufstat; >>>> - unsigned int count; >>>> - >>>> - ufstat = rd_regl(port, S3C2410_UFSTAT); >>>> - count = s3c24xx_serial_rx_fifocnt(ourport, ufstat); >>>> - >>>> - if (!count) >>>> - return; >>>> - >>>> - while (count-- > 0) { >>>> - ch = rd_regb(port, S3C2410_URXH); >>>> - >>>> - ourport->port.icount.rx++; >>>> - tty_insert_flip_char(tty, ch, TTY_NORMAL); >>>> - } >>>> - >>>> - tty_flip_buffer_push(tty); >>>> -} >>>> - >>>> static void s3c24xx_serial_stop_rx(struct uart_port *port) >>>> { >>>> struct s3c24xx_uart_port *ourport = to_ourport(port); >>>> @@ -573,6 +547,8 @@ static void enable_rx_pio(struct s3c24xx_uart_port *ourport) >>>> ourport->rx_mode = S3C24XX_RX_PIO; >>>> } >>>> >>>> +static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport); >>>> + >>>> static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id) >>>> { >>>> unsigned int utrstat, ufstat, received; >>>> @@ -606,7 +582,7 @@ static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id) >>>> enable_rx_pio(ourport); >>>> } >>>> >> >> The essence of change is here. We use another method for draining FIFO. >> Instead of just putting them into tty buffer, we additionally check for >> special conditions, and that's the improvement. > > Hm? I was referring to my comment - I did not see any changes around > "fixes" in commit message. Ohh, I see :p I will describe it better ;) Thanks, Robert