FAILED: patch "[PATCH] serial: max310x: implement gpio_chip::get_direction()" failed to apply to 6.1-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x a483b1a91b33b7533280e7c3efd2bc1275caef18
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072034-facing-tracing-f6eb@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a483b1a91b33b7533280e7c3efd2bc1275caef18 Mon Sep 17 00:00:00 2001
From: Tapio Reijonen <[email protected]>
Date: Mon, 15 Jun 2026 06:38:40 +0000
Subject: [PATCH] serial: max310x: implement gpio_chip::get_direction()
It's strongly recommended for GPIO drivers to always implement the .get_direction() callback - even when the direction is tracked in software. The GPIO core emits a warning when the callback is missing and a user reads the direction of a line, e.g. via /sys/kernel/debug/gpio.
The MAX310X keeps the GPIO direction in the GPIOCFG register (a set bit selects output), which the existing direction_input/output callbacks already program, so the current direction can be read back directly.
drivers/tty/serial/max310x.c +12 -0
@@ -1244,6 +1244,17 @@ static int max310x_gpio_set(struct gpio_chip *chip, unsigned int offset,return 0 ; } +static int max310x_gpio_get_direction (struct gpio_chip *chip,unsigned int offset) +{ +struct max310x_port *s =gpiochip_get_data (chip); +struct uart_port *port = &s->p[offset /4 ].port; +unsigned int val; + + val =max310x_port_read (port,MAX310X_GPIOCFG_REG ); + +return val &BIT (offset %4 ) ?GPIO_LINE_DIRECTION_OUT :GPIO_LINE_DIRECTION_IN ; +} +static int max310x_gpio_direction_input (struct gpio_chip *chip,unsigned int offset) {struct max310x_port *s =gpiochip_get_data (chip);
@@ -1447,6 +1458,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty s->gpio.owner =THIS_MODULE ; s->gpio.parent = dev; s->gpio.label = devtype->name; + s->gpio.get_direction = max310x_gpio_get_direction; s->gpio.direction_input = max310x_gpio_direction_input; s->gpio.get = max310x_gpio_get; s->gpio.direction_output= max310x_gpio_direction_output;
Sasha Levin
maintainerPATCH 1/2 serial: max310x: replace bare use of 'unsigned' with 'unsigned int' (checkpatch)
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 79b69eb09cf5b6a77e621b2838b7e0d38113debb ]
Fixes the following checkpatch warnings:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
With this change, the affected functions now match the prototypes in struct gpio_chip.
Stable-dep-of: a483b1a91b33 ("serial: max310x: implement gpio_chip::get_direction()")
--- drivers/tty/serial/max310x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/max310x.c +4 -4
@@ -1211,7 +1211,7 @@ static int __maybe_unused max310x_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(max310x_pm_ops, max310x_suspend, max310x_resume);#ifdef CONFIG_GPIOLIB -static int max310x_gpio_get (struct gpio_chip *chip,unsigned offset) +static int max310x_gpio_get (struct gpio_chip *chip,unsigned int offset) {unsigned int val;struct max310x_port *s =gpiochip_get_data (chip);
@@ -1222,7 +1222,7 @@ static int max310x_gpio_get(struct gpio_chip *chip, unsigned offset)return !!((val >>4 ) & (1 << (offset %4 ))); } -static void max310x_gpio_set (struct gpio_chip *chip,unsigned offset,int value) +static void max310x_gpio_set (struct gpio_chip *chip,unsigned int offset,int value) {struct max310x_port *s =gpiochip_get_data (chip);struct uart_port *port = &s->p[offset /4 ].port;
@@ -1231,7 +1231,7 @@ static void max310x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) value ? 1 << (offset % 4) : 0); } -static int max310x_gpio_direction_input (struct gpio_chip *chip,unsigned offset) +static int max310x_gpio_direction_input (struct gpio_chip *chip,unsigned int offset) {struct max310x_port *s =gpiochip_get_data (chip);struct uart_port *port = &s->p[offset /4 ].port;
@@ -1242,7 +1242,7 @@ static int max310x_gpio_direction_input(struct gpio_chip *chip, unsigned offset) }static int max310x_gpio_direction_output (struct gpio_chip *chip, -unsigned offset,int value) +unsigned int offset,int value) {struct max310x_port *s =gpiochip_get_data (chip);struct uart_port *port = &s->p[offset /4 ].port;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 serial: max310x: implement gpio_chip::get_direction()
From: Tapio Reijonen <[email protected]>
[ Upstream commit a483b1a91b33b7533280e7c3efd2bc1275caef18 ]
It's strongly recommended for GPIO drivers to always implement the .get_direction() callback - even when the direction is tracked in software. The GPIO core emits a warning when the callback is missing and a user reads the direction of a line, e.g. via /sys/kernel/debug/gpio.
The MAX310X keeps the GPIO direction in the GPIOCFG register (a set bit selects output), which the existing direction_input/output callbacks already program, so the current direction can be read back directly.
--- drivers/tty/serial/max310x.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/tty/serial/max310x.c +12 -0
@@ -1231,6 +1231,17 @@ static void max310x_gpio_set(struct gpio_chip *chip, unsigned int offset, int va value ? 1 << (offset % 4) : 0); } +static int max310x_gpio_get_direction (struct gpio_chip *chip,unsigned int offset) +{ +struct max310x_port *s =gpiochip_get_data (chip); +struct uart_port *port = &s->p[offset /4 ].port; +unsigned int val; + + val =max310x_port_read (port,MAX310X_GPIOCFG_REG ); + +return val &BIT (offset %4 ) ?GPIO_LINE_DIRECTION_OUT :GPIO_LINE_DIRECTION_IN ; +} +static int max310x_gpio_direction_input (struct gpio_chip *chip,unsigned int offset) {struct max310x_port *s =gpiochip_get_data (chip);
@@ -1439,6 +1450,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty s->gpio.owner =THIS_MODULE ; s->gpio.parent = dev; s->gpio.label = devtype->name; + s->gpio.get_direction = max310x_gpio_get_direction; s->gpio.direction_input = max310x_gpio_direction_input; s->gpio.get = max310x_gpio_get; s->gpio.direction_output= max310x_gpio_direction_output;
Signature · 1 line
2.53.0