From: Thierry Reding <[email protected]>

Check for OF support using IS_ENABLED(CONFIG_OF). This will enable the
compiler to eliminate dead code if OF support is disabled. With that in
place, the dummy implementation of bq24190_setup_dt() for non-DT setups
can be removed as the compiler will automatically discard the function
when appropriate.

Signed-off-by: Thierry Reding <[email protected]>
---
 drivers/power/bq24190_charger.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/power/bq24190_charger.c b/drivers/power/bq24190_charger.c
index ad3ff8fbfbbb..f5b21c0d0ba3 100644
--- a/drivers/power/bq24190_charger.c
+++ b/drivers/power/bq24190_charger.c
@@ -1312,7 +1312,6 @@ out:
        return ret;
 }
 
-#ifdef CONFIG_OF
 static int bq24190_setup_dt(struct bq24190_dev_info *bdi)
 {
        bdi->irq = irq_of_parse_and_map(bdi->dev->of_node, 0);
@@ -1321,12 +1320,6 @@ static int bq24190_setup_dt(struct bq24190_dev_info *bdi)
 
        return 0;
 }
-#else
-static int bq24190_setup_dt(struct bq24190_dev_info *bdi)
-{
-       return -1;
-}
-#endif
 
 static int bq24190_setup_pdata(struct bq24190_dev_info *bdi,
                struct bq24190_platform_data *pdata)
@@ -1388,7 +1381,7 @@ static int bq24190_probe(struct i2c_client *client,
 
        i2c_set_clientdata(client, bdi);
 
-       if (dev->of_node)
+       if (IS_ENABLED(CONFIG_OF) && dev->of_node)
                ret = bq24190_setup_dt(bdi);
        else
                ret = bq24190_setup_pdata(bdi, pdata);
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to