Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932409AbbGTJDa (ORCPT ); Mon, 20 Jul 2015 05:03:30 -0400 Received: from down.free-electrons.com ([37.187.137.238]:44665 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932146AbbGTJD2 (ORCPT ); Mon, 20 Jul 2015 05:03:28 -0400 Date: Mon, 20 Jul 2015 11:03:25 +0200 From: Thomas Petazzoni To: Maxime Ripard Cc: Vinod Koul , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Boris Brezillon , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 1/2] dmaengine: Add an enum for the dmaengine alignment constraints Message-ID: <20150720110325.502af335@free-electrons.com> In-Reply-To: <1437381693-18948-1-git-send-email-maxime.ripard@free-electrons.com> References: <1437381693-18948-1-git-send-email-maxime.ripard@free-electrons.com> Organization: Free Electrons X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.27; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1064 Lines: 39 Maxime, On Mon, 20 Jul 2015 10:41:32 +0200, Maxime Ripard wrote: > /** > + * enum dmaengine_alignment - defines alignment of the DMA async tx > + * buffers > + */ > +enum dmaengine_alignment { > + DMAENGINE_ALIGN_1_BYTE = 0, > + DMAENGINE_ALIGN_2_BYTES = 1, > + DMAENGINE_ALIGN_4_BYTES = 2, > + DMAENGINE_ALIGN_8_BYTES = 3, > + DMAENGINE_ALIGN_16_BYTES = 4, > + DMAENGINE_ALIGN_32_BYTES = 5, > + DMAENGINE_ALIGN_64_BYTES = 6, > +}; Sorry I didn't think about this during the first iteration, but this define is just the log2 of the values, no? So maybe you could simply do something like: static inline unsigned int dmaengine_alignment(size_t bytes) { return ilog2(bytes); } Best regards, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- 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/