gpio: constify arguments of gpiod_is_equal()

This function is not meant to modify the GPIO descriptors in any way so
we can safely constify both arguments.

Link: https://lore.kernel.org/r/20250620-gpiod-is-equal-improv-v1-1-a75060505d2c@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
pull/1309/head
Bartosz Golaszewski 2025-06-20 14:58:01 +02:00
parent 3315e39e56
commit 08ad63bbd6
2 changed files with 4 additions and 3 deletions

View File

@ -286,7 +286,7 @@ EXPORT_SYMBOL_GPL(gpiod_to_gpio_device);
* Returns:
* True if the descriptors refer to the same physical pin. False otherwise.
*/
bool gpiod_is_equal(struct gpio_desc *desc, struct gpio_desc *other)
bool gpiod_is_equal(const struct gpio_desc *desc, const struct gpio_desc *other)
{
return desc == other;
}

View File

@ -181,7 +181,8 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev,
enum gpiod_flags flags,
const char *label);
bool gpiod_is_equal(struct gpio_desc *desc, struct gpio_desc *other);
bool gpiod_is_equal(const struct gpio_desc *desc,
const struct gpio_desc *other);
#else /* CONFIG_GPIOLIB */
@ -551,7 +552,7 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev,
}
static inline bool
gpiod_is_equal(struct gpio_desc *desc, struct gpio_desc *other)
gpiod_is_equal(const struct gpio_desc *desc, const struct gpio_desc *other)
{
WARN_ON(desc || other);
return false;