lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 20 Jul 2015 11:03:25 +0200
From:	Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>
To:	Maxime Ripard <maxime.ripard@...e-electrons.com>
Cc:	Vinod Koul <vinod.koul@...el.com>,
	Nicolas Ferre <nicolas.ferre@...el.com>,
	Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
	Ludovic Desroches <ludovic.desroches@...el.com>,
	Boris Brezillon <boris.brezillon@...e-electrons.com>,
	dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 1/2] dmaengine: Add an enum for the dmaengine
 alignment constraints

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists