diff mbox series

[3/3] gpiolib: of: constify few local device_node variables

Message ID 20210728144229.323611-4-krzysztof.kozlowski@canonical.com
State Accepted
Commit 8990899d84d7f46c0c1cd3f41135707b26d0eeaa
Headers show
Series of/gpiolib: minor constifying | expand

Commit Message

Krzysztof Kozlowski July 28, 2021, 2:42 p.m. UTC
gpiolib does not modify struct device_node, so few local pointers can
point to a const data.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/gpio/gpiolib-of.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Krzysztof Kozlowski Aug. 11, 2021, 9:47 a.m. UTC | #1
On 11/08/2021 11:00, Linus Walleij wrote:
> On Wed, Jul 28, 2021 at 4:42 PM Krzysztof Kozlowski

> <krzysztof.kozlowski@canonical.com> wrote:

> 

>> gpiolib does not modify struct device_node, so few local pointers can

>> point to a const data.

>>

>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

> 

> LGTM

> Acked-by: Linus Walleij <linus.walleij@linaro.org>

> I guess this needs to be merged with the other two patches?

> I suppose in Rob Herrings DT tree?


Bartosz replied he merged it:
https://lore.kernel.org/lkml/CAMpxmJVtxy-GBWmFLp-tMAOf03Fr7fg8RZ2ndMbvAu_M3qEkHQ@mail.gmail.com/



Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 1e5a6f63b2fe..0ad288ab6262 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -122,7 +122,7 @@  static struct gpio_desc *of_xlate_and_get_gpiod_flags(struct gpio_chip *chip,
 bool of_gpio_need_valid_mask(const struct gpio_chip *gc)
 {
 	int size;
-	struct device_node *np = gc->of_node;
+	const struct device_node *np = gc->of_node;
 
 	size = of_property_count_u32_elems(np,  "gpio-reserved-ranges");
 	if (size > 0 && size % 2 == 0)
@@ -373,7 +373,7 @@  static struct gpio_desc *of_find_spi_gpio(struct device *dev, const char *con_id
 					  enum of_gpio_flags *of_flags)
 {
 	char prop_name[32]; /* 32 is max size of property name */
-	struct device_node *np = dev->of_node;
+	const struct device_node *np = dev->of_node;
 	struct gpio_desc *desc;
 
 	/*
@@ -404,7 +404,7 @@  static struct gpio_desc *of_find_spi_cs_gpio(struct device *dev,
 					     unsigned int idx,
 					     unsigned long *flags)
 {
-	struct device_node *np = dev->of_node;
+	const struct device_node *np = dev->of_node;
 
 	if (!IS_ENABLED(CONFIG_SPI_MASTER))
 		return ERR_PTR(-ENOENT);
@@ -440,7 +440,7 @@  static struct gpio_desc *of_find_regulator_gpio(struct device *dev, const char *
 		"wlf,ldo1ena", /* WM8994 */
 		"wlf,ldo2ena", /* WM8994 */
 	};
-	struct device_node *np = dev->of_node;
+	const struct device_node *np = dev->of_node;
 	struct gpio_desc *desc;
 	int i;