tps65090-charger: Use "IS_ENABLED(CONFIG_OF)" for DT code.
PATCH 1/1 tps65090-charger: Use "IS_ENABLED(CONFIG_OF)" for DT code.
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.
---
:100644 100644 bdd7b9b... 8b9c406... M drivers/power/tps65090-charger.c
drivers/power/tps65090-charger.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/power/tps65090-charger.c +5 -14
@@ -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) {
Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 61 lines · Manish Badarkhe
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 <[email protected]>---
:100644 100644 bdd7b9b... 8b9c406... Mdrivers/power/tps65090-charger.cdrivers/power/tps65090-charger.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)drivers/power/tps65090-charger.c +4
-13@@ -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) {
drivers/power/tps65090-charger.c static int tps65090_charger_probe(struct platform_device *pdev) · line 225
Quoted 8 lines
drivers/power/tps65090-charger.c +1
-1@@ -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
Signature · 5 lines
nvpublic -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Anton Vorontsov
AppliedQuoted 5 lines · Rhyland Klein
Quoted 4 lines · Manish Badarkhe
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.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Manish Badarkhe <[email protected]>---
:100644 100644 bdd7b9b... 8b9c406... Mdrivers/power/tps65090-charger.cdrivers/power/tps65090-charger.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)LGTM
Acked-by Rhyland Klein <[email protected]>
Applied, thanks!
Anton