Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750955AbbG0GuG (ORCPT ); Mon, 27 Jul 2015 02:50:06 -0400 Received: from down.free-electrons.com ([37.187.137.238]:40073 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750753AbbG0GuE (ORCPT ); Mon, 27 Jul 2015 02:50:04 -0400 Date: Mon, 27 Jul 2015 08:48:04 +0200 From: Maxime Ripard To: Thomas Petazzoni 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: <20150727064804.GN2564@lukather> References: <1437381693-18948-1-git-send-email-maxime.ripard@free-electrons.com> <20150720110325.502af335@free-electrons.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="H7cT1SUwsqXggVRO" Content-Disposition: inline In-Reply-To: <20150720110325.502af335@free-electrons.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2573 Lines: 75 --H7cT1SUwsqXggVRO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 20, 2015 at 11:03:25AM +0200, Thomas Petazzoni wrote: > Maxime, >=20 > On Mon, 20 Jul 2015 10:41:32 +0200, Maxime Ripard wrote: >=20 > > /** > > + * enum dmaengine_alignment - defines alignment of the DMA async tx > > + * buffers > > + */ > > +enum dmaengine_alignment { > > + DMAENGINE_ALIGN_1_BYTE =3D 0, > > + DMAENGINE_ALIGN_2_BYTES =3D 1, > > + DMAENGINE_ALIGN_4_BYTES =3D 2, > > + DMAENGINE_ALIGN_8_BYTES =3D 3, > > + DMAENGINE_ALIGN_16_BYTES =3D 4, > > + DMAENGINE_ALIGN_32_BYTES =3D 5, > > + DMAENGINE_ALIGN_64_BYTES =3D 6, > > +}; >=20 > 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: >=20 > static inline unsigned int dmaengine_alignment(size_t bytes) > { > return ilog2(bytes); > } I could, but all the rest of the other similar case so far in dmaengine are made through enum, so I guess it's still better for consistency. And we also provide a comprehensive list of the valid values this way, something a function would not provide (or at least not at compilation time) Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com --H7cT1SUwsqXggVRO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVtdQkAAoJEBx+YmzsjxAgPisP/11EEETJVZVL37HFUop5OQ6P fcv4O5AlPiKDdwB08/ei56Xp5twj9olj8fTiiDhj0OsZnrOiQv22XuNio3seea5i pV6LkfkcUO4Bc+vp/ZbOknu5ejhvqshnQP7GmMs1y+O2BQsk2LghOMcppuStTiTe 7n5CvMoVRgN1q9MuYNmKbBFTFI/xjFwmjHUPDYYS4lt3T7ajcp7/cYAoFnU51V/S 19k6l64FiDkJKWPSldSlv14pM12jfcUPELdgf8XlUV86tjlbyKGXAhn98I7UUfOe BsqYkip3xdHYk3bOV/oU4KaSaIGIS+NoGIrenPF4qMhOVJTVAxedt+KsKI3HeDxV EdQ7IcfJEACNIpdbrcJ8SQ37P5uvU+Buq3qCAvC4wN7HBbCfNu1CBblAQdVk/vE7 /Kyt5qMFBXOBdwTfAZJbuF71E4JYJ4o7X3SdkWhihiitcWmkU1v9aVys51Nh7Gzz HQ5vPf1vqpNdYO7qvEBrvajcpIr//wm9XgqgzVWnVZRT7caPyzrVA5hGdMGzZI+Y dWU7cGxnSU/wOqRbtIeME1pMMvCNNc88mPniAriUdLJgyLcdSQY4T0ONZgD2RPZQ ubCfto+hsIt2Ad83CjuxAmED+P+mDDr0D2Z3T4elRDJqhcfGL3X6v1TCIhaa8mjZ 2BCj4vQ0S6EWymeYUxHi =ZPW3 -----END PGP SIGNATURE----- --H7cT1SUwsqXggVRO-- -- 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/