public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Figa <tomasz.figa@gmail.com>
To: Manish Badarkhe <badarkhe.manish@gmail.com>,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: dbaryshkov@gmail.com, dwmw2@infradead.org
Subject: Re: [PATCH] max8925_power: Use "IS_ENABLED(CONFIG_OF)" for DT code.
Date: Sun, 26 Jan 2014 14:22:44 +0100	[thread overview]
Message-ID: <52E50C24.8030305@gmail.com> (raw)
In-Reply-To: <1390720540-13350-1-git-send-email-badarkhe.manish@gmail.com>

Hi Manish,

On 26.01.2014 08:15, Manish Badarkhe wrote:
> Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)"
> option for DT code to avoid if-deffery in code.
>
> Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com>
> ---
> :100644 100644 b4513f2... d353fbc... M	drivers/power/max8925_power.c
>   drivers/power/max8925_power.c |   14 +++++---------
>   1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c
> index b4513f2..d353fbc 100644
> --- a/drivers/power/max8925_power.c
> +++ b/drivers/power/max8925_power.c
> @@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct max8925_power_info *info)
>   	return 0;
>   }
>
> -#ifdef CONFIG_OF
>   static struct max8925_power_pdata *
>   max8925_power_dt_init(struct platform_device *pdev)
>   {
> @@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device *pdev)
>
>   	return pdata;
>   }
> -#else
> -static struct max8925_power_pdata *
> -max8925_power_dt_init(struct platform_device *pdev)
> -{
> -	return pdev->dev.platform_data;
> -}
> -#endif
>
>   static int max8925_power_probe(struct platform_device *pdev)
>   {
> @@ -483,7 +475,11 @@ static int max8925_power_probe(struct platform_device *pdev)
>   	struct max8925_power_info *info;
>   	int ret;
>
> -	pdata = max8925_power_dt_init(pdev);
> +	if (IS_ENABLED(CONFIG_OF))
> +		pdata = max8925_power_dt_init(pdev);
> +	else
> +		pdata = pdev->dev.platform_data;
> +

This does not look much better than before this patch. Instead of 
"if-deffery" outside function bodies you are adding "iffery" (if there 
is such a word) inside a function.

What about adding

	if (!IS_ENABLED(CONFIG_OF))
		return pdev->dev.platform_data;

on top of max8925_power_dt_init() instead or maybe also renaming this 
function to max8925_get_pdata()?

Best regards,
Tomasz

  reply	other threads:[~2014-01-26 13:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-26  7:15 [PATCH] max8925_power: Use "IS_ENABLED(CONFIG_OF)" for DT code Manish Badarkhe
2014-01-26 13:22 ` Tomasz Figa [this message]
2014-01-26 14:01   ` Manish Badarkhe
2014-01-26 21:45     ` Dmitry Torokhov
2014-01-26 21:49       ` Tomasz Figa
2014-01-26 22:31         ` Dmitry Eremin-Solenikov
2014-01-26 23:14           ` Dmitry Torokhov
2014-01-26 23:46             ` Dmitry Eremin-Solenikov
2014-01-27  7:27               ` Manish Badarkhe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52E50C24.8030305@gmail.com \
    --to=tomasz.figa@gmail.com \
    --cc=badarkhe.manish@gmail.com \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox