mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
gpio: tegra186: don't call the set() callback directly
Drivers should not dereference GPIO chip callbacks directly. Move the module's set() function higher to make it available to the direction_output() callback and call it instead. Link: https://lore.kernel.org/r/20250702-gpiochip-set-rv-gpio-round3-v1-1-0d23be74f71d@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
34c029c203
commit
47c228d9fc
|
|
@ -202,6 +202,26 @@ static int tegra186_init_valid_mask(struct gpio_chip *chip,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void tegra186_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int level)
|
||||
{
|
||||
struct tegra_gpio *gpio = gpiochip_get_data(chip);
|
||||
void __iomem *base;
|
||||
u32 value;
|
||||
|
||||
base = tegra186_gpio_get_base(gpio, offset);
|
||||
if (WARN_ON(base == NULL))
|
||||
return;
|
||||
|
||||
value = readl(base + TEGRA186_GPIO_OUTPUT_VALUE);
|
||||
if (level == 0)
|
||||
value &= ~TEGRA186_GPIO_OUTPUT_VALUE_HIGH;
|
||||
else
|
||||
value |= TEGRA186_GPIO_OUTPUT_VALUE_HIGH;
|
||||
|
||||
writel(value, base + TEGRA186_GPIO_OUTPUT_VALUE);
|
||||
}
|
||||
|
||||
static int tegra186_gpio_get_direction(struct gpio_chip *chip,
|
||||
unsigned int offset)
|
||||
{
|
||||
|
|
@ -251,7 +271,7 @@ static int tegra186_gpio_direction_output(struct gpio_chip *chip,
|
|||
u32 value;
|
||||
|
||||
/* configure output level first */
|
||||
chip->set(chip, offset, level);
|
||||
tegra186_gpio_set(chip, offset, level);
|
||||
|
||||
base = tegra186_gpio_get_base(gpio, offset);
|
||||
if (WARN_ON(base == NULL))
|
||||
|
|
@ -359,26 +379,6 @@ static int tegra186_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
|||
return value & BIT(0);
|
||||
}
|
||||
|
||||
static void tegra186_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int level)
|
||||
{
|
||||
struct tegra_gpio *gpio = gpiochip_get_data(chip);
|
||||
void __iomem *base;
|
||||
u32 value;
|
||||
|
||||
base = tegra186_gpio_get_base(gpio, offset);
|
||||
if (WARN_ON(base == NULL))
|
||||
return;
|
||||
|
||||
value = readl(base + TEGRA186_GPIO_OUTPUT_VALUE);
|
||||
if (level == 0)
|
||||
value &= ~TEGRA186_GPIO_OUTPUT_VALUE_HIGH;
|
||||
else
|
||||
value |= TEGRA186_GPIO_OUTPUT_VALUE_HIGH;
|
||||
|
||||
writel(value, base + TEGRA186_GPIO_OUTPUT_VALUE);
|
||||
}
|
||||
|
||||
static int tegra186_gpio_set_config(struct gpio_chip *chip,
|
||||
unsigned int offset,
|
||||
unsigned long config)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user