From: Greg Kroah-Hartman Date: Mon, 28 Feb 2022 09:13:35 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v4.9.304~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ea7db307276378d2e0a78e890dfadfe923f491a3;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: gpio-tegra186-fix-chip_data-type-confusion.patch pinctrl-fix-loop-in-k210_pinconf_get_drive.patch pinctrl-k210-fix-bias-pull-up.patch --- diff --git a/queue-5.15/gpio-tegra186-fix-chip_data-type-confusion.patch b/queue-5.15/gpio-tegra186-fix-chip_data-type-confusion.patch new file mode 100644 index 00000000000..eb43dcfd834 --- /dev/null +++ b/queue-5.15/gpio-tegra186-fix-chip_data-type-confusion.patch @@ -0,0 +1,80 @@ +From d1e972ace42390de739cde87d96043dcbe502286 Mon Sep 17 00:00:00 2001 +From: Marc Zyngier +Date: Fri, 11 Feb 2022 09:39:04 +0000 +Subject: gpio: tegra186: Fix chip_data type confusion + +From: Marc Zyngier + +commit d1e972ace42390de739cde87d96043dcbe502286 upstream. + +The tegra186 GPIO driver makes the assumption that the pointer +returned by irq_data_get_irq_chip_data() is a pointer to a +tegra_gpio structure. Unfortunately, it is actually a pointer +to the inner gpio_chip structure, as mandated by the gpiolib +infrastructure. Nice try. + +The saving grace is that the gpio_chip is the first member of +tegra_gpio, so the bug has gone undetected since... forever. + +Fix it by performing a container_of() on the pointer. This results +in no additional code, and makes it possible to understand how +the whole thing works. + +Fixes: 5b2b135a87fc ("gpio: Add Tegra186 support") +Signed-off-by: Marc Zyngier +Cc: Thierry Reding +Cc: Linus Walleij +Cc: Bartosz Golaszewski +Link: https://lore.kernel.org/r/20220211093904.1112679-1-maz@kernel.org +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpio/gpio-tegra186.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +--- a/drivers/gpio/gpio-tegra186.c ++++ b/drivers/gpio/gpio-tegra186.c +@@ -337,9 +337,12 @@ static int tegra186_gpio_of_xlate(struct + return offset + pin; + } + ++#define to_tegra_gpio(x) container_of((x), struct tegra_gpio, gpio) ++ + static void tegra186_irq_ack(struct irq_data *data) + { +- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); ++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); ++ struct tegra_gpio *gpio = to_tegra_gpio(gc); + void __iomem *base; + + base = tegra186_gpio_get_base(gpio, data->hwirq); +@@ -351,7 +354,8 @@ static void tegra186_irq_ack(struct irq_ + + static void tegra186_irq_mask(struct irq_data *data) + { +- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); ++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); ++ struct tegra_gpio *gpio = to_tegra_gpio(gc); + void __iomem *base; + u32 value; + +@@ -366,7 +370,8 @@ static void tegra186_irq_mask(struct irq + + static void tegra186_irq_unmask(struct irq_data *data) + { +- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); ++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); ++ struct tegra_gpio *gpio = to_tegra_gpio(gc); + void __iomem *base; + u32 value; + +@@ -381,7 +386,8 @@ static void tegra186_irq_unmask(struct i + + static int tegra186_irq_set_type(struct irq_data *data, unsigned int type) + { +- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); ++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); ++ struct tegra_gpio *gpio = to_tegra_gpio(gc); + void __iomem *base; + u32 value; + diff --git a/queue-5.15/pinctrl-fix-loop-in-k210_pinconf_get_drive.patch b/queue-5.15/pinctrl-fix-loop-in-k210_pinconf_get_drive.patch new file mode 100644 index 00000000000..b7f3c3fb9fa --- /dev/null +++ b/queue-5.15/pinctrl-fix-loop-in-k210_pinconf_get_drive.patch @@ -0,0 +1,34 @@ +From ba2ab85951c91a140a8fa51d8347d54e59ec009d Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 9 Feb 2022 21:08:06 +0300 +Subject: pinctrl: fix loop in k210_pinconf_get_drive() + +From: Dan Carpenter + +commit ba2ab85951c91a140a8fa51d8347d54e59ec009d upstream. + +The loop exited too early so the k210_pinconf_drive_strength[0] array +element was never used. + +Fixes: d4c34d09ab03 ("pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver") +Signed-off-by: Dan Carpenter +Reviewed-by: Damien Le Moal +Reviewed-by: Sean Anderson +Link: https://lore.kernel.org/r/20220209180804.GA18385@kili +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pinctrl/pinctrl-k210.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/pinctrl/pinctrl-k210.c ++++ b/drivers/pinctrl/pinctrl-k210.c +@@ -482,7 +482,7 @@ static int k210_pinconf_get_drive(unsign + { + int i; + +- for (i = K210_PC_DRIVE_MAX; i; i--) { ++ for (i = K210_PC_DRIVE_MAX; i >= 0; i--) { + if (k210_pinconf_drive_strength[i] <= max_strength_ua) + return i; + } diff --git a/queue-5.15/pinctrl-k210-fix-bias-pull-up.patch b/queue-5.15/pinctrl-k210-fix-bias-pull-up.patch new file mode 100644 index 00000000000..d282d8120b3 --- /dev/null +++ b/queue-5.15/pinctrl-k210-fix-bias-pull-up.patch @@ -0,0 +1,33 @@ +From e9f7b9228a94778edb7a63fde3c0a3c5bb793064 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Wed, 9 Feb 2022 13:28:22 -0500 +Subject: pinctrl: k210: Fix bias-pull-up + +From: Sean Anderson + +commit e9f7b9228a94778edb7a63fde3c0a3c5bb793064 upstream. + +Using bias-pull-up would actually cause the pin to have its pull-down +enabled. Fix this. + +Signed-off-by: Sean Anderson +Reviewed-by: Damien Le Moal +Fixes: d4c34d09ab03 ("pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver") +Link: https://lore.kernel.org/r/20220209182822.640905-1-seanga2@gmail.com +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pinctrl/pinctrl-k210.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/pinctrl/pinctrl-k210.c ++++ b/drivers/pinctrl/pinctrl-k210.c +@@ -527,7 +527,7 @@ static int k210_pinconf_set_param(struct + case PIN_CONFIG_BIAS_PULL_UP: + if (!arg) + return -EINVAL; +- val |= K210_PC_PD; ++ val |= K210_PC_PU; + break; + case PIN_CONFIG_DRIVE_STRENGTH: + arg *= 1000; diff --git a/queue-5.15/series b/queue-5.15/series index a74c947f2a6..4d6a9850305 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -131,3 +131,6 @@ tty-n_gsm-fix-null-pointer-access-due-to-dlci-release.patch tty-n_gsm-fix-wrong-tty-control-line-for-flow-control.patch tty-n_gsm-fix-wrong-modem-processing-in-convergence-layer-type-2.patch tty-n_gsm-fix-deadlock-in-gsmtty_open.patch +pinctrl-fix-loop-in-k210_pinconf_get_drive.patch +pinctrl-k210-fix-bias-pull-up.patch +gpio-tegra186-fix-chip_data-type-confusion.patch