Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: gpio-mm-lantiq: Use of_property_read_u32

Instead of parsing manually the shadow content, use the much simpler
helper of_property_read_u32.

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: John Crispin <blogic@openwrt.org>
Cc: devicetree@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Ricardo Ribalda Delgado and committed by
Linus Walleij
68a99b18 f3f26c2f

+3 -4
+3 -4
drivers/gpio/gpio-mm-lantiq.c
··· 105 105 static int ltq_mm_probe(struct platform_device *pdev) 106 106 { 107 107 struct ltq_mm *chip; 108 - const __be32 *shadow; 108 + u32 shadow; 109 109 110 110 chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); 111 111 if (!chip) ··· 117 117 chip->mmchip.save_regs = ltq_mm_save_regs; 118 118 119 119 /* store the shadow value if one was passed by the devicetree */ 120 - shadow = of_get_property(pdev->dev.of_node, "lantiq,shadow", NULL); 121 - if (shadow) 122 - chip->shadow = be32_to_cpu(*shadow); 120 + if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow)) 121 + chip->shadow = shadow; 123 122 124 123 return of_mm_gpiochip_add(pdev->dev.of_node, &chip->mmchip); 125 124 }