mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] power: bq24190: Remove gratuitous dummy function
@ 2014-03-13  8:07 Thierry Reding
  2014-03-13  8:07 ` [PATCH 2/2] power: bq24190: Remove empty OF device table Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Thierry Reding @ 2014-03-13  8:07 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov, David Woodhouse; +Cc: linux-kernel

From: Thierry Reding <treding@nvidia.com>

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 <treding@nvidia.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-13  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-13  8:07 [PATCH 1/2] power: bq24190: Remove gratuitous dummy function Thierry Reding
2014-03-13  8:07 ` [PATCH 2/2] power: bq24190: Remove empty OF device table Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®