Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'gpio-fixes-for-v6.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

- fix a regression in pin access control in gpio-tegra186

- make data pointer dereference robust in Intel Tangier driver

* tag 'gpio-fixes-for-v6.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
gpio: tegra186: Fix tegra186_gpio_is_accessible() check
gpio: tangier: Use correct type for the IRQ chip data

+17 -12
+6 -3
drivers/gpio/gpio-tangier.c
··· 195 195 196 196 static void tng_irq_ack(struct irq_data *d) 197 197 { 198 - struct tng_gpio *priv = irq_data_get_irq_chip_data(d); 198 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 199 + struct tng_gpio *priv = gpiochip_get_data(gc); 199 200 irq_hw_number_t gpio = irqd_to_hwirq(d); 200 201 void __iomem *gisr; 201 202 u8 shift; ··· 228 227 229 228 static void tng_irq_mask(struct irq_data *d) 230 229 { 231 - struct tng_gpio *priv = irq_data_get_irq_chip_data(d); 230 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 231 + struct tng_gpio *priv = gpiochip_get_data(gc); 232 232 irq_hw_number_t gpio = irqd_to_hwirq(d); 233 233 234 234 tng_irq_unmask_mask(priv, gpio, false); ··· 238 236 239 237 static void tng_irq_unmask(struct irq_data *d) 240 238 { 241 - struct tng_gpio *priv = irq_data_get_irq_chip_data(d); 239 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 240 + struct tng_gpio *priv = gpiochip_get_data(gc); 242 241 irq_hw_number_t gpio = irqd_to_hwirq(d); 243 242 244 243 gpiochip_enable_irq(&priv->chip, gpio);
+11 -9
drivers/gpio/gpio-tegra186.c
··· 36 36 #define TEGRA186_GPIO_SCR_SEC_REN BIT(27) 37 37 #define TEGRA186_GPIO_SCR_SEC_G1W BIT(9) 38 38 #define TEGRA186_GPIO_SCR_SEC_G1R BIT(1) 39 - #define TEGRA186_GPIO_FULL_ACCESS (TEGRA186_GPIO_SCR_SEC_WEN | \ 40 - TEGRA186_GPIO_SCR_SEC_REN | \ 41 - TEGRA186_GPIO_SCR_SEC_G1R | \ 42 - TEGRA186_GPIO_SCR_SEC_G1W) 43 - #define TEGRA186_GPIO_SCR_SEC_ENABLE (TEGRA186_GPIO_SCR_SEC_WEN | \ 44 - TEGRA186_GPIO_SCR_SEC_REN) 45 39 46 40 /* control registers */ 47 41 #define TEGRA186_GPIO_ENABLE_CONFIG 0x00 ··· 171 177 172 178 value = __raw_readl(secure + TEGRA186_GPIO_SCR); 173 179 174 - if ((value & TEGRA186_GPIO_SCR_SEC_ENABLE) == 0) 175 - return true; 180 + /* 181 + * When SCR_SEC_[R|W]EN is unset, then we have full read/write access to all the 182 + * registers for given GPIO pin. 183 + * When SCR_SEC[R|W]EN is set, then there is need to further check the accompanying 184 + * SCR_SEC_G1[R|W] bit to determine read/write access to all the registers for given 185 + * GPIO pin. 186 + */ 176 187 177 - if ((value & TEGRA186_GPIO_FULL_ACCESS) == TEGRA186_GPIO_FULL_ACCESS) 188 + if (((value & TEGRA186_GPIO_SCR_SEC_REN) == 0 || 189 + ((value & TEGRA186_GPIO_SCR_SEC_REN) && (value & TEGRA186_GPIO_SCR_SEC_G1R))) && 190 + ((value & TEGRA186_GPIO_SCR_SEC_WEN) == 0 || 191 + ((value & TEGRA186_GPIO_SCR_SEC_WEN) && (value & TEGRA186_GPIO_SCR_SEC_G1W)))) 178 192 return true; 179 193 180 194 return false;