Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750955AbdGZE5T (ORCPT ); Wed, 26 Jul 2017 00:57:19 -0400 Received: from mga03.intel.com ([134.134.136.65]:14757 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750711AbdGZE5R (ORCPT ); Wed, 26 Jul 2017 00:57:17 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,413,1496127600"; d="scan'208";a="1155442676" Date: Wed, 26 Jul 2017 10:30:07 +0530 From: Vinod Koul To: Pierre Yves MORDRET Cc: Rob Herring , Mark Rutland , Maxime Coquelin , Alexandre TORGUE , Russell King , Dan Williams , "M'boumba Cedric Madianga" , Fabrice GASNIER , Herbert Xu , Fabien DESSENNE , Amelie DELAUNAY , "dmaengine@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Message-ID: <20170726050007.GE3053@localhost> References: <1499343941-6375-1-git-send-email-pierre-yves.mordret@st.com> <1499343941-6375-3-git-send-email-pierre-yves.mordret@st.com> <20170721075547.GO3053@localhost> <20170721095411.GR3053@localhost> <3c04c9bf-572d-98a6-ff62-83498bbc7fdf@st.com> <20170721171735.GS3053@localhost> <320f8def-19a4-0491-e879-b41815889e15@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <320f8def-19a4-0491-e879-b41815889e15@st.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1496 Lines: 52 On Mon, Jul 24, 2017 at 09:34:18AM +0000, Pierre Yves MORDRET wrote: > > On 07/21/2017 12:32 PM, Pierre Yves MORDRET wrote: > > > > > > On 07/21/2017 11:54 AM, Vinod Koul wrote: > >> On Fri, Jul 21, 2017 at 09:30:00AM +0000, Pierre Yves MORDRET wrote: > >>>>> +static enum dma_slave_buswidth stm32_mdma_get_max_width(u32 buf_len, u32 > tlen) > >>>>> +{ > >>>>> + enum dma_slave_buswidth max_width = DMA_SLAVE_BUSWIDTH_8_BYTES; > >>>>> + > >>>>> + while (((buf_len % max_width) || (tlen < max_width)) && > >>>>> + (max_width > DMA_SLAVE_BUSWIDTH_1_BYTE)) > >>>>> + max_width = max_width >> 1; > >>>> > >>>> ok, this is a bit hard to read... > >>> > >>> This code snippet has already been reworked and optimized. Would you mind to > >>> provide me a example with your expectation ? Thanks > >> > >> Code is optimized yes, but readable no > >> > >> I would like readability to be improved upon... > >> > > > > gotcha > > > > Doest he code snippet below has a better looking for you ? > > for (max_width = DMA_SLAVE_BUSWIDTH_8_BYTES; > max_width > DMA_SLAVE_BUSWIDTH_1_BYTE; max_width >>= 1) > if (((buf_len % max_width) == 0) && (tlen >= max_width)) > break; Am actually not sure :( Indentation wise it is still a bit messy to follow.. How about: for (max_width = DMA_SLAVE_BUSWIDTH_8_BYTES; max_width > DMA_SLAVE_BUSWIDTH_1_BYTE; max_width >>=1) { if (((buf_len % max_width) == 0) && (tlen >= max_width)) break; } Thanks -- ~Vinod