From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH RFC v2] media: i2c: mt9p031: add OF support Date: Thu, 02 May 2013 15:42:19 +0200 Message-ID: <3547278.d3Q4LvxEgy@wuerfel> References: <1367475754-19477-1-git-send-email-prabhakar.csengg@gmail.com> <20130502065518.GN32299@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: In-Reply-To: <20130502065518.GN32299@pengutronix.de> Sender: linux-media-owner@vger.kernel.org To: devicetree-discuss@lists.ozlabs.org Cc: Sascha Hauer , Prabhakar Lad , DLOS , Mauro Carvalho Chehab , linux-doc@vger.kernel.org, LKML , Rob Herring , Hans Verkuil , Laurent Pinchart , Sylwester Nawrocki , Sakari Ailus , Guennadi Liakhovetski , LMML List-Id: devicetree@vger.kernel.org On Thursday 02 May 2013 08:55:18 Sascha Hauer wrote: > > +#if defined(CONFIG_OF) > > +static struct mt9p031_platform_data * > > + mt9p031_get_pdata(struct i2c_client *client) > > + > > +{ > > + if (client->dev.of_node) { > > By inverting the logic here and returning immediately you can safe an > indention level for the bulk of this function. Right, also make this if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node) return client->dev.platform_data; Then the rest of the function gets discarded by the compiler when CONFIG_OF is not set, and you can kill the #ifdef around the function. Arnd