From patchwork Wed Jul 11 12:27:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 1182041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 983FEDF25A for ; Wed, 11 Jul 2012 12:32:04 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sow1B-0006ko-B7; Wed, 11 Jul 2012 12:27:45 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Sow12-0006kN-3e for linux-arm-kernel@lists.infradead.org; Wed, 11 Jul 2012 12:27:37 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id q6BCRVgF005274; Wed, 11 Jul 2012 07:27:31 -0500 Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6BCRT60012908; Wed, 11 Jul 2012 17:57:30 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 14.1.323.3; Wed, 11 Jul 2012 17:57:29 +0530 Received: from ula0393217.india.ti.com (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6BCRRBR005069; Wed, 11 Jul 2012 17:57:28 +0530 From: Shubhrajyoti D To: Subject: [PATCH RFC] tty: serial: OMAP: Pass the uart device instead of NULL Date: Wed, 11 Jul 2012 17:57:22 +0530 Message-ID: <1342009642-5060-1-git-send-email-shubhrajyoti@ti.com> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.40 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Shubhrajyoti D , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Currently the dma_alloc passes NULL instead of the uart device. Fix the same by passing the device parameter. Also fixes the below warn. [ 8613.094604] omap_uart omap_uart.0: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x0000] [ 8613.109374] Modules linked in: [ 8613.112640] [] (unwind_backtrace+0x0/0xf0) from [] (warn_slowpath_common+0x4c/0x64) [ 8613.122497] [] (warn_slowpath_common+0x4c/0x64) from [] (warn_slowpath_fmt+0x30/0x40) [ 8613.132537] [] (warn_slowpath_fmt+0x30/0x40) from [] (check_unmap+0x6c8/0x7a8) [ 8613.141937] [] (check_unmap+0x6c8/0x7a8) from [] (debug_dma_free_coherent+0x58/0x64) [ 8613.151916] [] (debug_dma_free_coherent+0x58/0x64) from [] (serial_omap_shutdown+0x1d0/0x28c) [ 8613.162689] [] (serial_omap_shutdown+0x1d0/0x28c) from [] (uart_suspend_port+0x294/0x2bc) [ 8613.173095] [] (uart_suspend_port+0x294/0x2bc) from [] (serial_omap_suspend+0x1c/0x30) [ 8613.183227] [] (serial_omap_suspend+0x1c/0x30) from [] (platform_pm_suspend+0x2c/0x5c) [ 8613.193389] [] (platform_pm_suspend+0x2c/0x5c) from [] (dpm_run_callback.clone.7+0x30/0xb0) [ 8613.203979] [] (dpm_run_callback.clone.7+0x30/0xb0) from [] (__device_suspend+0x124/0x260) [ 8613.214477] [] (__device_suspend+0x124/0x260) from [] (dpm_suspend+0x5c/0x218) [ 8613.223907] [] (dpm_suspend+0x5c/0x218) from [] (suspend_devices_and_enter+0x78/0x2d0) [ 8613.234039] [] (suspend_devices_and_enter+0x78/0x2d0) from [] (pm_suspend+0x18c/0x208) [ 8613.244171] [] (pm_suspend+0x18c/0x208) from [] (state_store+0x120/0x134) [ 8613.253143] [] (state_store+0x120/0x134) from [] (kobj_attr_store+0x14/0x20) [ 8613.262359] [] (kobj_attr_store+0x14/0x20) from [] (sysfs_write_file+0x100/0x184) [ 8613.272064] [] (sysfs_write_file+0x100/0x184) from [] (vfs_write+0xb4/0x148) [ 8613.281280] [] (vfs_write+0xb4/0x148) from [] (sys_write+0x40/0x70) [ 8613.289703] [] (sys_write+0x40/0x70) from [] (ret_fast_syscall+0x0/0x3c) [ 8613.298553] ---[ end trace e9beb8b35111c507 ]--- While at it also set the coherent mask. Otherwise we get warnings like. omap_uart omap_uart.0: coherent DMA mask is unset Signed-off-by: Shubhrajyoti D --- Boot tested on omap4 drivers/tty/serial/omap-serial.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index d3cda0c..df1ab2f 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -574,18 +574,20 @@ static int serial_omap_startup(struct uart_port *port) up->msr_saved_flags = 0; if (up->use_dma) { + dma_set_coherent_mask(up->port.dev, DMA_BIT_MASK(32)); free_page((unsigned long)up->port.state->xmit.buf); - up->port.state->xmit.buf = dma_alloc_coherent(NULL, + up->port.state->xmit.buf = dma_alloc_coherent(up->port.dev, UART_XMIT_SIZE, (dma_addr_t *)&(up->uart_dma.tx_buf_dma_phys), - 0); + GFP_KERNEL); init_timer(&(up->uart_dma.rx_timer)); up->uart_dma.rx_timer.function = serial_omap_rxdma_poll; up->uart_dma.rx_timer.data = up->port.line; /* Currently the buffer size is 4KB. Can increase it */ - up->uart_dma.rx_buf = dma_alloc_coherent(NULL, + up->uart_dma.rx_buf = dma_alloc_coherent(up->port.dev, up->uart_dma.rx_buf_size, - (dma_addr_t *)&(up->uart_dma.rx_buf_dma_phys), 0); + (dma_addr_t *)&(up->uart_dma.rx_buf_dma_phys), + GFP_KERNEL); } /* * Finally, enable interrupts. Note: Modem status interrupts