From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3000630AbdEAKQB (ORCPT ); Mon, 1 May 2017 06:16:01 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:59828 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2999994AbdEAKPv (ORCPT ); Mon, 1 May 2017 06:15:51 -0400 Message-ID: <59070AD5.7030405@mentor.com> Date: Mon, 1 May 2017 03:15:49 -0700 From: Jiada Wang User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120411 Thunderbird/11.0.1 MIME-Version: 1.0 To: Mark Brown CC: , , Subject: Re: [PATCH 1/2] spi: imx: dynamic burst length adjust for PIO mode References: <20170208062028.22313-1-jiada_wang@mentor.com> <20170208062028.22313-2-jiada_wang@mentor.com> <20170214182019.s3o5uphsfz4bxlkq@sirena.org.uk> In-Reply-To: <20170214182019.s3o5uphsfz4bxlkq@sirena.org.uk> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Mark Sorry, somehow I missed your following comment On 02/14/2017 10:20 AM, Mark Brown wrote: > On Wed, Feb 08, 2017 at 03:20:27PM +0900, Jiada Wang wrote: > > This looks basically fine, a couple of fairly minor things here: > >> + for (i = 0; i< transfer->len / 4; i++) { >> + u8 temp; >> + >> + temp = *(buf + i * 4); >> + *(buf + i * 4) = *(buf + i * 4 + 3); >> + *(buf + i * 4 + 3) = temp; > Should this be using one of the cpu_to_ functions? It's a bit unclear > what the goal is here and if it'll work if the kernel is big endian > (which people do do with i.MX systems IIRC). indeed, with big endian kernel, this function won't work I will replace the algo here with cpu_to_* in next version Thanks, Jiada >> + if (spi_imx->bpw_w == 1) >> + spi_imx_buf_rx_u8(spi_imx); >> + else if (spi_imx->bpw_w == 2) >> + spi_imx_buf_rx_u16(spi_imx); > switch statement please. > >> + if (spi_imx->dynamic_burst) { >> + spi_imx->count_index = >> + spi_imx->count> MX51_ECSPI_CTRL_MAX_BURST ? >> + spi_imx->count % MX51_ECSPI_CTRL_MAX_BURST : >> + spi_imx->count % sizeof(u32); > Just write a normal if statement please, it's easier to read.