Skip to content

Commit

Permalink
gpiolib: of: constify few local device_node variables
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
  • Loading branch information
Krzysztof Kozlowski authored and Bartosz Golaszewski committed Aug 5, 2021
1 parent e6ae9a8 commit 8990899
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/gpio/gpiolib-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

/*
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 8990899

Please sign in to comment.