diff mbox series

gpio: constify opaque pointer "data" in gpio_device_find()

Message ID 20240216135217.129795-1-krzysztof.kozlowski@linaro.org
State Accepted
Commit 4a92857d6e8383eca6d661538bb25dc7004fd391
Headers show
Series gpio: constify opaque pointer "data" in gpio_device_find() | expand

Commit Message

Krzysztof Kozlowski Feb. 16, 2024, 1:52 p.m. UTC
The opaque pointer "data" in each match function used by
gpio_device_find() is a pointer to const, thus the same argument passed
to gpio_device_find() can adjusted similarly.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/gpio/gpiolib.c      | 2 +-
 include/linux/gpio/driver.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Bartosz Golaszewski Feb. 17, 2024, 7:03 p.m. UTC | #1
On Fri, Feb 16, 2024 at 2:52 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> The opaque pointer "data" in each match function used by
> gpio_device_find() is a pointer to const, thus the same argument passed
> to gpio_device_find() can adjusted similarly.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/gpio/gpiolib.c      | 2 +-
>  include/linux/gpio/driver.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 0e332b24c7b8..8c9cb324b7a4 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1112,7 +1112,7 @@ EXPORT_SYMBOL_GPL(gpiochip_remove);
>   * If the function returns non-NULL, the returned reference must be freed by
>   * the caller using gpio_device_put().
>   */
> -struct gpio_device *gpio_device_find(void *data,
> +struct gpio_device *gpio_device_find(const void *data,
>                                      int (*match)(struct gpio_chip *gc,
>                                                   const void *data))
>  {
> diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
> index 51b23211794d..251a610f2234 100644
> --- a/include/linux/gpio/driver.h
> +++ b/include/linux/gpio/driver.h
> @@ -628,7 +628,7 @@ int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc,
>                                     void *data, struct lock_class_key *lock_key,
>                                     struct lock_class_key *request_key);
>
> -struct gpio_device *gpio_device_find(void *data,
> +struct gpio_device *gpio_device_find(const void *data,
>                                 int (*match)(struct gpio_chip *gc, const void *data));
>  struct gpio_device *gpio_device_find_by_label(const char *label);
>  struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode);
> --
> 2.34.1
>

Applied, thanks!

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 0e332b24c7b8..8c9cb324b7a4 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1112,7 +1112,7 @@  EXPORT_SYMBOL_GPL(gpiochip_remove);
  * If the function returns non-NULL, the returned reference must be freed by
  * the caller using gpio_device_put().
  */
-struct gpio_device *gpio_device_find(void *data,
+struct gpio_device *gpio_device_find(const void *data,
 				     int (*match)(struct gpio_chip *gc,
 						  const void *data))
 {
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 51b23211794d..251a610f2234 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -628,7 +628,7 @@  int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc,
 				    void *data, struct lock_class_key *lock_key,
 				    struct lock_class_key *request_key);
 
-struct gpio_device *gpio_device_find(void *data,
+struct gpio_device *gpio_device_find(const void *data,
 				int (*match)(struct gpio_chip *gc, const void *data));
 struct gpio_device *gpio_device_find_by_label(const char *label);
 struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode);