From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753289AbYITRMd (ORCPT ); Sat, 20 Sep 2008 13:12:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750884AbYITRMW (ORCPT ); Sat, 20 Sep 2008 13:12:22 -0400 Received: from fg-out-1718.google.com ([72.14.220.154]:52823 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752842AbYITRMV (ORCPT ); Sat, 20 Sep 2008 13:12:21 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=BOD/EcRXikrCm8RNIv/cZN8yWV+vlVVqejOjSsQUTHKNPRbTD5Kz+97ocCDinbO9EM cS3UzPONrw9wAbSrhmtlzANnJy6hSNWzX5pKUTv1/loylaTWwfRYm+W+nHT+vfJwsa1Y xfkYZgYJYFbj1/CV2KbWLMr4KcumwzKTok68s= Date: Sat, 20 Sep 2008 21:12:16 +0400 From: Cyrill Gorcunov To: Christer Weinigel Cc: Alexey Dobriyan , Russ Dill , Eric Miao , linux-arm-kernel@lists.arm.linux.org.uk, Ben Dooks , linux-kernel@vger.kernel.org Subject: Re: kernel.h: add ARRAY_AND_SIZE() macro to complement ARRAY_SIZE(). Message-ID: <20080920171216.GD7354@localhost> References: <20080919065426.GA7222@lenovo> <20080919175544.GA3228@x200.localdomain> <48D4F519.2080509@weinigel.se> <20080920134543.GA7354@localhost> <48D50883.6040700@weinigel.se> <20080920144504.GB7354@localhost> <48D5271B.7010109@weinigel.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48D5271B.7010109@weinigel.se> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Christer Weinigel - Sat, Sep 20, 2008 at 06:38:51PM +0200] > Cyrill Gorcunov wrote: >> [Christer Weinigel - Sat, Sep 20, 2008 at 04:28:19PM +0200] >> ... >>> In my opinion, making platform_add_devices into a magic macro is >>> actually worse, since the same construct (array, ARRAY_SIZE(array)) >>> is used in many places, so one would have to do the same thing over >>> and over again for every function. In that case it's better to have >>> to learn one macro once, and the ALL_CAPITALS should make it obvious >>> that it is a macro. > >> Well, can't agree with you :) It's my _presonal_ opinion. >> You could define it as >> >> static inline int platform_add_devices_array(struct platform_device **devs) >> { >> return platform_add_devices(devs, ARRAY_SIZE(devs)); >> } > > Won't work. You would have to use a macro. The above would turn into: > > platform_add_devices(devs, 1); > > or would if the __must_be_array check didn't catch it. > > /Christer > Ah...indeed, my bad :) gcc is not that smart (yet). So there only the macro is possible (just forget that it will be different namespace scope). Anyway even having it like a macro would be better then hiding args. - Cyrill -