diff options
author | Martin Blumenstingl <martin.blumenstingl@googlemail.com> | 2015-05-26 17:12:00 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-06-02 05:22:02 -0400 |
commit | 50f09073932362d29020b03ca8510f14acc0ca17 (patch) | |
tree | 6030a195022f084f5e59e1a871a30ea7939f172c /drivers/gpio/gpio-stp-xway.c | |
parent | ffb8e44bd7617ede81d526d33d13d96a2c6a6e20 (diff) |
gpio: stp-xway: Use the of_property_read_u32 helper
This removes some redundant code but does not have any functional impact.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-stp-xway.c')
-rw-r--r-- | drivers/gpio/gpio-stp-xway.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c index 6d4148f53b51..81bdbe7ba2a4 100644 --- a/drivers/gpio/gpio-stp-xway.c +++ b/drivers/gpio/gpio-stp-xway.c | |||
@@ -200,7 +200,7 @@ static int xway_stp_hw_init(struct xway_stp *chip) | |||
200 | static int xway_stp_probe(struct platform_device *pdev) | 200 | static int xway_stp_probe(struct platform_device *pdev) |
201 | { | 201 | { |
202 | struct resource *res; | 202 | struct resource *res; |
203 | const __be32 *shadow, *groups, *dsl, *phy; | 203 | u32 shadow, groups, dsl, phy; |
204 | struct xway_stp *chip; | 204 | struct xway_stp *chip; |
205 | struct clk *clk; | 205 | struct clk *clk; |
206 | int ret = 0; | 206 | int ret = 0; |
@@ -223,33 +223,28 @@ static int xway_stp_probe(struct platform_device *pdev) | |||
223 | chip->gc.owner = THIS_MODULE; | 223 | chip->gc.owner = THIS_MODULE; |
224 | 224 | ||
225 | /* store the shadow value if one was passed by the devicetree */ | 225 | /* store the shadow value if one was passed by the devicetree */ |
226 | shadow = of_get_property(pdev->dev.of_node, "lantiq,shadow", NULL); | 226 | if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow)) |
227 | if (shadow) | 227 | chip->shadow = shadow; |
228 | chip->shadow = be32_to_cpu(*shadow); | ||
229 | 228 | ||
230 | /* find out which gpio groups should be enabled */ | 229 | /* find out which gpio groups should be enabled */ |
231 | groups = of_get_property(pdev->dev.of_node, "lantiq,groups", NULL); | 230 | if (!of_property_read_u32(pdev->dev.of_node, "lantiq,groups", &groups)) |
232 | if (groups) | 231 | chip->groups = groups & XWAY_STP_GROUP_MASK; |
233 | chip->groups = be32_to_cpu(*groups) & XWAY_STP_GROUP_MASK; | ||
234 | else | 232 | else |
235 | chip->groups = XWAY_STP_GROUP0; | 233 | chip->groups = XWAY_STP_GROUP0; |
236 | chip->gc.ngpio = fls(chip->groups) * 8; | 234 | chip->gc.ngpio = fls(chip->groups) * 8; |
237 | 235 | ||
238 | /* find out which gpios are controlled by the dsl core */ | 236 | /* find out which gpios are controlled by the dsl core */ |
239 | dsl = of_get_property(pdev->dev.of_node, "lantiq,dsl", NULL); | 237 | if (!of_property_read_u32(pdev->dev.of_node, "lantiq,dsl", &dsl)) |
240 | if (dsl) | 238 | chip->dsl = dsl & XWAY_STP_ADSL_MASK; |
241 | chip->dsl = be32_to_cpu(*dsl) & XWAY_STP_ADSL_MASK; | ||
242 | 239 | ||
243 | /* find out which gpios are controlled by the phys */ | 240 | /* find out which gpios are controlled by the phys */ |
244 | if (of_machine_is_compatible("lantiq,ar9") || | 241 | if (of_machine_is_compatible("lantiq,ar9") || |
245 | of_machine_is_compatible("lantiq,gr9") || | 242 | of_machine_is_compatible("lantiq,gr9") || |
246 | of_machine_is_compatible("lantiq,vr9")) { | 243 | of_machine_is_compatible("lantiq,vr9")) { |
247 | phy = of_get_property(pdev->dev.of_node, "lantiq,phy1", NULL); | 244 | if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy1", &phy)) |
248 | if (phy) | 245 | chip->phy1 = phy & XWAY_STP_PHY_MASK; |
249 | chip->phy1 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK; | 246 | if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy2", &phy)) |
250 | phy = of_get_property(pdev->dev.of_node, "lantiq,phy2", NULL); | 247 | chip->phy2 = phy & XWAY_STP_PHY_MASK; |
251 | if (phy) | ||
252 | chip->phy2 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK; | ||
253 | } | 248 | } |
254 | 249 | ||
255 | /* check which edge trigger we should use, default to a falling edge */ | 250 | /* check which edge trigger we should use, default to a falling edge */ |