From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751814AbYITQjT (ORCPT ); Sat, 20 Sep 2008 12:39:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751694AbYITQiy (ORCPT ); Sat, 20 Sep 2008 12:38:54 -0400 Received: from 2-1-3-15a.ens.sth.bostream.se ([82.182.31.214]:36542 "EHLO zoo.weinigel.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579AbYITQix (ORCPT ); Sat, 20 Sep 2008 12:38:53 -0400 Message-ID: <48D5271B.7010109@weinigel.se> Date: Sat, 20 Sep 2008 18:38:51 +0200 From: Christer Weinigel User-Agent: Thunderbird 2.0.0.16 (X11/20080723) MIME-Version: 1.0 To: Cyrill Gorcunov 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(). References: <20080918132447.516309749@fluff.org.uk> <20080918150624.GA3421@x200.localdomain> <20080919065426.GA7222@lenovo> <20080919175544.GA3228@x200.localdomain> <48D4F519.2080509@weinigel.se> <20080920134543.GA7354@localhost> <48D50883.6040700@weinigel.se> <20080920144504.GB7354@localhost> In-Reply-To: <20080920144504.GB7354@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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