Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752624AbbKICqm (ORCPT ); Sun, 8 Nov 2015 21:46:42 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:36567 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752423AbbKICqj (ORCPT ); Sun, 8 Nov 2015 21:46:39 -0500 Subject: Re: [PATCH V3 3/4] dmaselftest: add memcpy selftest support functions To: Timur Tabi , dmaengine@vger.kernel.org, cov@codeaurora.org, jcm@redhat.com References: <1446958380-23298-1-git-send-email-okaya@codeaurora.org> <1446958380-23298-4-git-send-email-okaya@codeaurora.org> <563EDA15.7070606@codeaurora.org> Cc: agross@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Vinod Koul , Dan Williams , linux-kernel@vger.kernel.org From: Sinan Kaya Message-ID: <56400909.2090300@codeaurora.org> Date: Sun, 8 Nov 2015 21:46:33 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <563EDA15.7070606@codeaurora.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1570 Lines: 63 On 11/8/2015 12:13 AM, Timur Tabi wrote: > Sinan Kaya wrote: > >> +static int dma_selftest_sg(struct dma_device *dmadev, >> + struct dma_chan *dma_chanptr, u64 size, >> + unsigned long flags) >> +{ >> + dma_addr_t src_dma, dest_dma, dest_dma_it; >> + u8 *dest_buf; >> + u32 i, j = 0; >> + dma_cookie_t cookie; >> + struct dma_async_tx_descriptor *tx; >> + int err = 0; >> + int ret; >> + struct sg_table sg_table; >> + struct scatterlist *sg; >> + int nents = 10, count; >> + bool free_channel = 1; > > Booleans are either 'true' or 'false'. > OK >> +static int dma_selftest_mapsngle(struct device *dev) >> +{ >> + u32 buf_size = 256; >> + char *src; >> + int ret = -ENOMEM; >> + dma_addr_t dma_src; >> + >> + src = kmalloc(buf_size, GFP_KERNEL); >> + if (!src) >> + return -ENOMEM; >> + >> + strcpy(src, "hello world"); > > kstrdup()? > > And why kmalloc anyway? Why not leave it on the stack? > > char src[] = "hello world"; > > ? I need to call dma_map_single on this address to convert it to a DMA address. That's why. > > -- Sinan Kaya Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- 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/