From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932495AbbEaIMT (ORCPT ); Sun, 31 May 2015 04:12:19 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42201 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751071AbbEaIMJ (ORCPT ); Sun, 31 May 2015 04:12:09 -0400 Date: Sun, 31 May 2015 10:12:07 +0200 Message-ID: From: Takashi Iwai To: Mikko Rapeli Cc: linux-kernel@vger.kernel.org, Jaroslav Kysela , alsa-devel@alsa-project.org, linux-api@vger.kernel.org Subject: Re: [PATCH 18/98] include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP etc macros In-Reply-To: References: <1433000370-19509-1-git-send-email-mikko.rapeli@iki.fi> <1433000370-19509-19-git-send-email-mikko.rapeli@iki.fi> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Sun, 31 May 2015 09:18:57 +0200, Takashi Iwai wrote: > > At Sat, 30 May 2015 17:38:10 +0200, > Mikko Rapeli wrote: > > > > Fixes userspace compilation error: > > > > error: expected specifier-qualifier-list before ‘DECLARE_BITMAP’ > > DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ > > > > DECLARE_BITMAP etc macros are not meant for userspace headers and thus > > added here as private copies for emu10k.h. > > > > Fix was suggested by Arnd Bergmann in message > > <2168807.4Yxh5gl11Q@wuerfel> on lkml. > > > > Signed-off-by: Mikko Rapeli > > --- > > include/uapi/sound/emu10k1.h | 23 ++++++++++++++++++++--- > > 1 file changed, 20 insertions(+), 3 deletions(-) > > > > diff --git a/include/uapi/sound/emu10k1.h b/include/uapi/sound/emu10k1.h > > index ec1535b..7575f0f 100644 > > --- a/include/uapi/sound/emu10k1.h > > +++ b/include/uapi/sound/emu10k1.h > > @@ -34,6 +34,23 @@ > > > > #define EMU10K1_FX8010_PCM_COUNT 8 > > > > +/* > > + * Following definitions are copies from kernel headers to support compiling > > + * this header file in userspace. The definitions are not generally available > > + * in uapi headers so the needed things are copied here wtih __EMU10k1 prefix. > > + */ > > + > > +/* From include/linux/bitops.h */ > > +#define __EMU10K1_BITS_PER_BYTE 8 > > +/* From include/linux/kernel.h */ > > +#define __EMU10K1_DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) > > +/* From include/linux/bitops.h */ > > +#define __EMU10K1_BITS_TO_LONGS(nr) \ > > + __EMU10K1_DIV_ROUND_UP(nr, __EMU10K1_BITS_PER_BYTE * sizeof(long)) > > +/* From include/linux/types.h */ > > +#define __EMU10K1_DECLARE_BITMAP(name,bits) \ > > + unsigned long name[__EMU10K1_BITS_TO_LONGS(bits)] > > This is way too complicated just for a few expansion of the aligned > size arrays, IMO. Rather simplify it like below with a comment: > > /* the array must be aligned to unsigned long (i.e. 4 or 8 bytes) */ > #define __EMU10K1_DECLARE_BITMAP(name) \ > unsigned long name[(bits) / sizeof(unsigned long)] Crap, of course, it must be multiplied with 8. /* the array must be aligned to unsigned long (i.e. 32 or 64) */ #define __EMU10K1_DECLARE_BITMAP(name) \ unsigned long name[(bits) / (sizeof(unsigned long) * 8)] Takashi