diff options
author | Manish Badarkhe <badarkhe.manish@gmail.com> | 2013-12-22 12:48:49 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-01-21 03:28:58 -0500 |
commit | 01c3f110f3e2557212925c041d961816a4c6fc63 (patch) | |
tree | 163cde728bc8b5eb26ebc99ba3da9825d64f72cf /drivers/mfd | |
parent | 754fa7bc9852f17d3c79b93747b643e1665ce0de (diff) |
mfd: max8997: Use "IS_ENABLED(CONFIG_OF)" for DT code.
Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)"
option for DT code to avoid if-deffery in code.
Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/max8997.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 10141698ff94..be88a3bf7b85 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c | |||
@@ -133,7 +133,6 @@ int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask) | |||
133 | } | 133 | } |
134 | EXPORT_SYMBOL_GPL(max8997_update_reg); | 134 | EXPORT_SYMBOL_GPL(max8997_update_reg); |
135 | 135 | ||
136 | #ifdef CONFIG_OF | ||
137 | /* | 136 | /* |
138 | * Only the common platform data elements for max8997 are parsed here from the | 137 | * Only the common platform data elements for max8997 are parsed here from the |
139 | * device tree. Other sub-modules of max8997 such as pmic, rtc and others have | 138 | * device tree. Other sub-modules of max8997 such as pmic, rtc and others have |
@@ -164,24 +163,15 @@ static struct max8997_platform_data *max8997_i2c_parse_dt_pdata( | |||
164 | 163 | ||
165 | return pd; | 164 | return pd; |
166 | } | 165 | } |
167 | #else | ||
168 | static struct max8997_platform_data *max8997_i2c_parse_dt_pdata( | ||
169 | struct device *dev) | ||
170 | { | ||
171 | return 0; | ||
172 | } | ||
173 | #endif | ||
174 | 166 | ||
175 | static inline int max8997_i2c_get_driver_data(struct i2c_client *i2c, | 167 | static inline int max8997_i2c_get_driver_data(struct i2c_client *i2c, |
176 | const struct i2c_device_id *id) | 168 | const struct i2c_device_id *id) |
177 | { | 169 | { |
178 | #ifdef CONFIG_OF | 170 | if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) { |
179 | if (i2c->dev.of_node) { | ||
180 | const struct of_device_id *match; | 171 | const struct of_device_id *match; |
181 | match = of_match_node(max8997_pmic_dt_match, i2c->dev.of_node); | 172 | match = of_match_node(max8997_pmic_dt_match, i2c->dev.of_node); |
182 | return (int)match->data; | 173 | return (int)match->data; |
183 | } | 174 | } |
184 | #endif | ||
185 | return (int)id->driver_data; | 175 | return (int)id->driver_data; |
186 | } | 176 | } |
187 | 177 | ||
@@ -203,7 +193,7 @@ static int max8997_i2c_probe(struct i2c_client *i2c, | |||
203 | max8997->type = max8997_i2c_get_driver_data(i2c, id); | 193 | max8997->type = max8997_i2c_get_driver_data(i2c, id); |
204 | max8997->irq = i2c->irq; | 194 | max8997->irq = i2c->irq; |
205 | 195 | ||
206 | if (max8997->dev->of_node) { | 196 | if (IS_ENABLED(CONFIG_OF) && max8997->dev->of_node) { |
207 | pdata = max8997_i2c_parse_dt_pdata(max8997->dev); | 197 | pdata = max8997_i2c_parse_dt_pdata(max8997->dev); |
208 | if (IS_ERR(pdata)) | 198 | if (IS_ERR(pdata)) |
209 | return PTR_ERR(pdata); | 199 | return PTR_ERR(pdata); |