Re: [PATCH RFC v2] media: i2c: mt9p031: add OF support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux