From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752715AbcGTQCl (ORCPT ); Wed, 20 Jul 2016 12:02:41 -0400 Received: from sauhun.de ([89.238.76.85]:38214 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752307AbcGTQCe (ORCPT ); Wed, 20 Jul 2016 12:02:34 -0400 Date: Wed, 20 Jul 2016 18:02:21 +0200 From: Wolfram Sang To: Bing Sun Cc: gregkh@linuxfoundation.org, wsa+renesas@sang-engineering.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, sunbing.linux@gmail.com Subject: Re: [PATCH] Staging: ks7010: michael_mic: fixed macros coding style issue Message-ID: <20160720160221.GJ1688@katana> References: <1468893066-4712-1-git-send-email-sunbing@redflag-linux.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PEkEgRdBLZYkpbX2" Content-Disposition: inline In-Reply-To: <1468893066-4712-1-git-send-email-sunbing@redflag-linux.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 --PEkEgRdBLZYkpbX2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 19, 2016 at 09:51:06AM +0800, Bing Sun wrote: > Fixed coding style issue: > Enclose multiple statements macros definition in a do while loop. > Use one space around binary operators. >=20 > Signed-off-by: Bing Sun Looks good for what it is. One comment below. I will test this tomorrow. > --- > drivers/staging/ks7010/michael_mic.c | 20 +++++++++++++------- > 1 file changed, 13 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks701= 0/michael_mic.c > index e14c109..d332678 100644 > --- a/drivers/staging/ks7010/michael_mic.c > +++ b/drivers/staging/ks7010/michael_mic.c > @@ -20,15 +20,21 @@ > #define getUInt32( A, B ) (uint32_t)(A[B+0] << 0) + (A[B+1] << 8) + (A[= B+2] << 16) + (A[B+3] << 24) > =20 > // Convert from UInt32 to Byte[] in a portable way > -#define putUInt32( A, B, C ) A[B+0] =3D (uint8_t) (C & 0xff); \ > - A[B+1] =3D (uint8_t) ((C>>8) & 0xff); \ > - A[B+2] =3D (uint8_t) ((C>>16) & 0xff); \ > - A[B+3] =3D (uint8_t) ((C>>24) & 0xff) > +#define putUInt32(A, B, C) \ > +do { \ > + A[B + 0] =3D (uint8_t)(C & 0xff); \ > + A[B + 1] =3D (uint8_t)((C >> 8) & 0xff); \ > + A[B + 2] =3D (uint8_t)((C >> 16) & 0xff); \ > + A[B + 3] =3D (uint8_t)((C >> 24) & 0xff); \ > +} while (0) We surely have helper functions for this in the kernel? > =20 > // Reset the state to the empty message. > -#define MichaelClear( A ) A->L =3D A->K0; \ > - A->R =3D A->K1; \ > - A->nBytesInM =3D 0; > +#define MichaelClear(A) \ > +do { \ > + A->L =3D A->K0; \ > + A->R =3D A->K1; \ > + A->nBytesInM =3D 0; \ > +} while (0) > =20 > static > void MichaelInitializeFunction(struct michel_mic_t *Mic, uint8_t * key) > --=20 > 2.1.0 >=20 --PEkEgRdBLZYkpbX2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXj6CNAAoJEBQN5MwUoCm2bNYP/RGWgw5gLxiccOj2t4sZi4ZR FJIbuZOc51mXIPIGZjsSym/SKefkV1As1zR5aMzV7mLDzLe6VwYPZXYCyhJiKnRT ysDpz4hZJfjgC1rqtyzlPP8LxP18mLfZyoyGRtrEjrgHvjKT6uXrGPsiSpJd3IRN la/2awyvCbr57NazqR/QIJd3q/HCDAAT0rubWAGsvHbVTs+R6VmDrqvjdFzWcK5F YKt5xXFpuPpH8KP5gptel54TNGBX/0P2HQgp898+YgYlR0zGXLs+Z76aXTX0h+71 dPdxzsv9FGUDJ+V9Opy2xsbrhaV23hx1Cj1cIEw692oftBatJQDCxebvUmgqnI+i Sn7fflsFGrrbpgPgjJtOwBPyXiSVesInXtkZnrMt/ueDoBlITlUalMwIilsDee+n u38QpPvBlrmd6YUTA6Ut8tEY87NjNplcaK/WXXT1VN9g6MJWYWWdrNSAvRrHUG6J 09AcwAXzjafIAjddKl0kDqBD6R0aeK9FvzamKH7lUwmpoFW8oRlr2nHe0jgmzqpm khltsjdIcmM1kvPnsVWnsMWzCiJEvQTCn3jZC73feUKMiNCT5pY6pK0Y8LGeQCcZ obCzMM6lIlHlDPdJHACE87usPIiOmntFCAtG26tIJKAd/+FgIbM9uKY1P+fvNEEz j3zSyPMy6rxkHF+em7y7 =i8RL -----END PGP SIGNATURE----- --PEkEgRdBLZYkpbX2--