lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <52E799A9.8080502@samsung.com>
Date:	Tue, 28 Jan 2014 12:51:05 +0100
From:	Tomasz Figa <t.figa@...sung.com>
To:	Manish Badarkhe <badarkhe.manish@...il.com>,
	linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:	dbaryshkov@...il.com, dwmw2@...radead.org
Subject: Re: [PATCH V3] max8925_power: Use "IS_ENABLED(CONFIG_OF)" for DT code.

Hi,

On 27.01.2014 19:37, Manish Badarkhe wrote:
> Instead of "#ifdef CONFIG_OF" use "IS_ENABLED(CONFIG_OF)"
> option for DT code to avoid if-deffery in code.
>
> Signed-off-by: Manish Badarkhe <badarkhe.manish@...il.com>
> ---
> :100644 100644 b4513f2... 3e54476... M	drivers/power/max8925_power.c
>   drivers/power/max8925_power.c |   17 +++++------------
>   1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c
> index b4513f2..3e54476 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)
>   {
> @@ -440,9 +439,6 @@ max8925_power_dt_init(struct platform_device *pdev)
>   	int no_insert_detect;
>   	struct max8925_power_pdata *pdata;
>
> -	if (!nproot)
> -		return pdev->dev.platform_data;
> -
>   	np = of_find_node_by_name(nproot, "charger");
>   	if (!np) {
>   		dev_err(&pdev->dev, "failed to find charger node\n");
> @@ -468,13 +464,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 +472,11 @@ static int max8925_power_probe(struct platform_device *pdev)
>   	struct max8925_power_info *info;
>   	int ret;
>
> -	pdata = max8925_power_dt_init(pdev);
> +	pdata = dev_get_platdata(&pdev->dev);
> +
> +	if (!pdata && chip->dev->of_node)

Shouldn't IS_ENABLED(CONFIG_OF) also be checked here to let the compiler 
throw max8925_power_dt_init() away if the condition always evaluates to 
false?

Best regards,
Tomasz
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ