From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bw0-f42.google.com (mail-bw0-f42.google.com [209.85.214.42]) by ozlabs.org (Postfix) with ESMTP id 680F2B6EDD for ; Sun, 8 Aug 2010 17:40:41 +1000 (EST) Received: by bwz17 with SMTP id 17so1186697bwz.15 for ; Sun, 08 Aug 2010 00:40:39 -0700 (PDT) Date: Sun, 8 Aug 2010 11:40:35 +0400 From: Anton Vorontsov To: Grant Likely Subject: Re: [PATCH v2] powerpc/mpc8xxx_gpio.c: extend the driver to support mpc512x gpios Message-ID: <20100808074035.GA26199@oksana.dev.rtsoft.ru> References: <1281187711-10215-1-git-send-email-agust@denx.de> <1281207816-31807-1-git-send-email-agust@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 In-Reply-To: Cc: linuxppc-dev@ozlabs.org, Anatolij Gustschin , Wolfgang Denk , Detlev Zundel List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Sat, Aug 07, 2010 at 06:40:22PM -0600, Grant Likely wrote: [...] > > static int __init mpc8xxx_add_gpiochips(void) > > { > >+ const struct of_device_id *id; > > struct device_node *np; > > > >- for_each_compatible_node(np, NULL, "fsl,mpc8349-gpio") > >- mpc8xxx_add_controller(np); > >- > >- for_each_compatible_node(np, NULL, "fsl,mpc8572-gpio") > >- mpc8xxx_add_controller(np); > >- > >- for_each_compatible_node(np, NULL, "fsl,mpc8610-gpio") > >+ for_each_matching_node(np, mpc8xxx_gpio_ids) { > >+ id = of_match_node(mpc8xxx_gpio_ids, np); > >+ if (id) > >+ np->data = id->data; > > mpc8xxx_add_controller(np); > >+ } [...] > Actually, there is absolutely no reason to keep mpc8xxx_add_gpiochip() > as a separate function with the simplification of > mpc8xxx_add_gpiochips(). I'd simplify the whole thing by merging the > two functions together. You mean mpc8xxx_add_controller()? Putting 65-line function on a second indentation level, inside the for loop... sounds like a bad idea. -- Anton Vorontsov email: cbouatmailru@gmail.com irc://irc.freenode.net/bd2