diff mbox series

spi: pxa2xx: Fix '"CONFIG_OF" is not defined' warning

Message ID 20181114173107.1229717-1-lkundrak@v3.sk (mailing list archive)
State Superseded
Headers show
Series spi: pxa2xx: Fix '"CONFIG_OF" is not defined' warning | expand

Commit Message

Lubomir Rintel Nov. 14, 2018, 5:31 p.m. UTC
A careless oversight. Sorry.

Fixes: 0a897143b7c9 ("spi: pxa2xx: Add slave mode support")
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/spi/spi-pxa2xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Robert Jarzmik Nov. 14, 2018, 7:15 p.m. UTC | #1
Lubomir Rintel <lkundrak@v3.sk> writes:

> A careless oversight. Sorry.
>
> Fixes: 0a897143b7c9 ("spi: pxa2xx: Add slave mode support")
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---
>  drivers/spi/spi-pxa2xx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
> index 29e6025f104c..7194070e4009 100644
> --- a/drivers/spi/spi-pxa2xx.c
> +++ b/drivers/spi/spi-pxa2xx.c
> @@ -1555,7 +1555,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
>  	}
>  #endif
>  
> -#if CONFIG_OF
> +#ifdef CONFIG_OF
>  	if (of_id) {
>  		pdata->is_slave = of_property_read_bool(pdev->dev.of_node,
>  								"spi-slave");
While at it, why not simply remove the "#if CONFIG_OF", the if (of_id), and
write simply this, without any ifs ? :
	pdata->is_slave = of_property_read_bool(pdev->dev.of_node,
						"spi-slave");

If CONFIG_OF=n, of_property_read_bool() is guaranteed to return false. If the
device is not found through devicetree, of_node == NULL and a false will
still be returned. And the last case is your bool read case (ie. when devicetree
probed the device).

Cheers.
diff mbox series

Patch

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 29e6025f104c..7194070e4009 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1555,7 +1555,7 @@  pxa2xx_spi_init_pdata(struct platform_device *pdev)
 	}
 #endif
 
-#if CONFIG_OF
+#ifdef CONFIG_OF
 	if (of_id) {
 		pdata->is_slave = of_property_read_bool(pdev->dev.of_node,
 								"spi-slave");