Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1696775

Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Vinod Koul <vinod.koul@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver
Date Wed, 26 Jul 2017 07:00:01 +0200
Message-ID <u7mAp-49B-1@gated-at.bofh.it> (permalink)
References <u0e4V-4gf-3@gated-at.bofh.it> <u0e4W-4gf-29@gated-at.bofh.it> <u5B0R-1Xy-3@gated-at.bofh.it> <u5CzF-34w-35@gated-at.bofh.it> <u5CT0-3b5-21@gated-at.bofh.it> <u5DvI-3Ew-17@gated-at.bofh.it> <u5JKN-7DO-3@gated-at.bofh.it> <u6I0i-2Vp-19@gated-at.bofh.it>
X-Original-To Pierre Yves MORDRET <pierre-yves.mordret@st.com>
X-Extloop1 1
X-Ironport-Av E=Sophos;i="5.40,413,1496127600"; d="scan'208";a="1155442676"
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.24 (2015-08-30)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 52
Organization linux.* mail to news gateway
X-Original-Cc Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre TORGUE <alexandre.torgue@st.com>, Russell King <linux@armlinux.org.uk>, Dan Williams <dan.j.williams@intel.com>, M'boumba Cedric Madianga <cedric.madianga@gmail.com>, Fabrice GASNIER <fabrice.gasnier@st.com>, Herbert Xu <herbert@gondor.apana.org.au>, Fabien DESSENNE <fabien.dessenne@st.com>, Amelie DELAUNAY <amelie.delaunay@st.com>, "dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
X-Original-Date Wed, 26 Jul 2017 10:30:07 +0530
X-Original-Message-ID <20170726050007.GE3053@localhost>
X-Original-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> <ee278ecf-02a3-7799-888a-9590d1105bb3@st.com> <20170721095411.GR3053@localhost> <3c04c9bf-572d-98a6-ff62-83498bbc7fdf@st.com> <20170721171735.GS3053@localhost> <320f8def-19a4-0491-e879-b41815889e15@st.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1696775

Show key headers only | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Vinod Koul <vinod.koul@intel.com> - 2017-07-21 10:00 +0200
  Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Pierre Yves MORDRET <pierre-yves.mordret@st.com> - 2017-07-21 11:40 +0200
    Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Vinod Koul <vinod.koul@intel.com> - 2017-07-21 12:00 +0200
      Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Pierre Yves MORDRET <pierre-yves.mordret@st.com> - 2017-07-21 12:40 +0200
        Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Vinod Koul <vinod.koul@intel.com> - 2017-07-21 19:20 +0200
          Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Pierre Yves MORDRET <pierre-yves.mordret@st.com> - 2017-07-24 11:40 +0200
            Re: [PATCH v2 2/4] dmaengine: Add STM32 MDMA driver Vinod Koul <vinod.koul@intel.com> - 2017-07-26 07:00 +0200

csiph-web