* [PATCH] tps65090-charger: Use "IS_ENABLED(CONFIG_OF)" for DT code.
@ 2013-09-28 4:32 Manish Badarkhe
[not found] ` <1380342744-4227-1-git-send-email-badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Manish Badarkhe @ 2013-09-28 4:32 UTC (permalink / raw)
To: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w,
rklein-DDmLM1+adcrQT0dZR+AlfA, anton-9xeibp6oKSgdnm+yROfE0A,
dwmw2-wEGCiKHe2LqWVfeAwA7xHQ
Instead of "#if defined(CONFIG_OF)" use "IS_ENABLED(CONFIG_OF)" option
for DT code to avoid if-deffery in code.
Also, arranged header files in alphabetically.
Signed-off-by: Manish Badarkhe <badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
:100644 100644 bdd7b9b... 8b9c406... M drivers/power/tps65090-charger.c
drivers/power/tps65090-charger.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/drivers/power/tps65090-charger.c b/drivers/power/tps65090-charger.c
index bdd7b9b..8b9c406 100644
--- a/drivers/power/tps65090-charger.c
+++ b/drivers/power/tps65090-charger.c
@@ -15,15 +15,17 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <linux/delay.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
+#include <linux/slab.h>
+
#include <linux/mfd/tps65090.h>
#define TPS65090_REG_INTR_STS 0x00
@@ -185,10 +187,6 @@ static irqreturn_t tps65090_charger_isr(int irq, void *dev_id)
return IRQ_HANDLED;
}
-#if defined(CONFIG_OF)
-
-#include <linux/of_device.h>
-
static struct tps65090_platform_data *
tps65090_parse_dt_charger_data(struct platform_device *pdev)
{
@@ -210,13 +208,6 @@ static struct tps65090_platform_data *
return pdata;
}
-#else
-static struct tps65090_platform_data *
- tps65090_parse_dt_charger_data(struct platform_device *pdev)
-{
- return NULL;
-}
-#endif
static int tps65090_charger_probe(struct platform_device *pdev)
{
@@ -228,7 +219,7 @@ static int tps65090_charger_probe(struct platform_device *pdev)
pdata = dev_get_platdata(pdev->dev.parent);
- if (!pdata && pdev->dev.of_node)
+ if (IS_ENABLED(CONFIG_OF) && !pdata && pdev->dev.of_node)
pdata = tps65090_parse_dt_charger_data(pdev);
if (!pdata) {
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1380342744-4227-1-git-send-email-badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] tps65090-charger: Use "IS_ENABLED(CONFIG_OF)" for DT code. [not found] ` <1380342744-4227-1-git-send-email-badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2013-09-30 16:03 ` Rhyland Klein 2013-10-25 23:08 ` Anton Vorontsov 0 siblings, 1 reply; 3+ messages in thread From: Rhyland Klein @ 2013-09-30 16:03 UTC (permalink / raw) To: Manish Badarkhe Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, anton-9xeibp6oKSgdnm+yROfE0A@public.gmane.org, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org On 9/28/2013 12:32 AM, Manish Badarkhe wrote: > Instead of "#if defined(CONFIG_OF)" use "IS_ENABLED(CONFIG_OF)" option > for DT code to avoid if-deffery in code. > Also, arranged header files in alphabetically. > > Signed-off-by: Manish Badarkhe <badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > --- > :100644 100644 bdd7b9b... 8b9c406... M drivers/power/tps65090-charger.c > drivers/power/tps65090-charger.c | 19 +++++-------------- > 1 file changed, 5 insertions(+), 14 deletions(-) > > diff --git a/drivers/power/tps65090-charger.c b/drivers/power/tps65090-charger.c > index bdd7b9b..8b9c406 100644 > --- a/drivers/power/tps65090-charger.c > +++ b/drivers/power/tps65090-charger.c > @@ -15,15 +15,17 @@ > * You should have received a copy of the GNU General Public License > * along with this program. If not, see <http://www.gnu.org/licenses/>. > */ > +#include <linux/delay.h> > #include <linux/err.h> > #include <linux/init.h> > #include <linux/interrupt.h> > #include <linux/kernel.h> > #include <linux/module.h> > -#include <linux/slab.h> > -#include <linux/delay.h> > +#include <linux/of_device.h> > #include <linux/platform_device.h> > #include <linux/power_supply.h> > +#include <linux/slab.h> > + > #include <linux/mfd/tps65090.h> > > #define TPS65090_REG_INTR_STS 0x00 > @@ -185,10 +187,6 @@ static irqreturn_t tps65090_charger_isr(int irq, void *dev_id) > return IRQ_HANDLED; > } > > -#if defined(CONFIG_OF) > - > -#include <linux/of_device.h> > - > static struct tps65090_platform_data * > tps65090_parse_dt_charger_data(struct platform_device *pdev) > { > @@ -210,13 +208,6 @@ static struct tps65090_platform_data * > return pdata; > > } > -#else > -static struct tps65090_platform_data * > - tps65090_parse_dt_charger_data(struct platform_device *pdev) > -{ > - return NULL; > -} > -#endif > > static int tps65090_charger_probe(struct platform_device *pdev) > { > @@ -228,7 +219,7 @@ static int tps65090_charger_probe(struct platform_device *pdev) > > pdata = dev_get_platdata(pdev->dev.parent); > > - if (!pdata && pdev->dev.of_node) > + if (IS_ENABLED(CONFIG_OF) && !pdata && pdev->dev.of_node) > pdata = tps65090_parse_dt_charger_data(pdev); > > if (!pdata) { > LGTM Acked-by: Rhyland Klein <rklein-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> -- nvpublic -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tps65090-charger: Use "IS_ENABLED(CONFIG_OF)" for DT code. 2013-09-30 16:03 ` Rhyland Klein @ 2013-10-25 23:08 ` Anton Vorontsov 0 siblings, 0 replies; 3+ messages in thread From: Anton Vorontsov @ 2013-10-25 23:08 UTC (permalink / raw) To: Rhyland Klein Cc: Manish Badarkhe, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org On Mon, Sep 30, 2013 at 12:03:40PM -0400, Rhyland Klein wrote: > On 9/28/2013 12:32 AM, Manish Badarkhe wrote: > > Instead of "#if defined(CONFIG_OF)" use "IS_ENABLED(CONFIG_OF)" option > > for DT code to avoid if-deffery in code. > > Also, arranged header files in alphabetically. > > > > Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com> > > --- > > :100644 100644 bdd7b9b... 8b9c406... M drivers/power/tps65090-charger.c > > drivers/power/tps65090-charger.c | 19 +++++-------------- > > 1 file changed, 5 insertions(+), 14 deletions(-) > LGTM > Acked-by: Rhyland Klein <rklein@nvidia.com> Applied, thanks! Anton ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-25 23:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-28 4:32 [PATCH] tps65090-charger: Use "IS_ENABLED(CONFIG_OF)" for DT code Manish Badarkhe
[not found] ` <1380342744-4227-1-git-send-email-badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-30 16:03 ` Rhyland Klein
2013-10-25 23:08 ` Anton Vorontsov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).