diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | 2024-02-08 21:27:04 +0100 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-02-12 10:18:31 +0100 |
commit | faf6efd2e5e23d3319501132d9671c8606ef21bd (patch) | |
tree | 8b698b9a557ea0eafb984ee1dc6337c24f62702e /drivers/gpio/gpiolib-of.c | |
parent | 104e00bbc76fc2a0fe887649d01d9c15f0e08021 (diff) | |
download | lwn-faf6efd2e5e23d3319501132d9671c8606ef21bd.tar.gz lwn-faf6efd2e5e23d3319501132d9671c8606ef21bd.zip |
gpio: constify opaque pointer in gpio_device_find() match function
The match function used in gpio_device_find() should not modify the
contents of passed opaque pointer, because such modification would not
be necessary for actual matching and it could lead to quite unreadable,
spaghetti code.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[Bartosz: fix coding style in header]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib-of.c')
-rw-r--r-- | drivers/gpio/gpiolib-of.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 77509aa19900..35d717fd393f 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -118,9 +118,10 @@ int of_gpio_get_count(struct device *dev, const char *con_id) return ret ? ret : -ENOENT; } -static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, void *data) +static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, + const void *data) { - struct of_phandle_args *gpiospec = data; + const struct of_phandle_args *gpiospec = data; return device_match_of_node(&chip->gpiodev->dev, gpiospec->np) && chip->of_xlate && @@ -852,7 +853,7 @@ static void of_gpiochip_remove_hog(struct gpio_chip *chip, gpiochip_free_own_desc(desc); } -static int of_gpiochip_match_node(struct gpio_chip *chip, void *data) +static int of_gpiochip_match_node(struct gpio_chip *chip, const void *data) { return device_match_of_node(&chip->gpiodev->dev, data); } |