From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E72B416139; Thu, 30 Jul 2026 14:47:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785422868; cv=none; b=bqs2nhVcUCtgNhBmYRBPMCdcKDwKbmoUO97h0YQLnobfZWdPOYF8djI5AWZDVtPxJXc8f2nf4AhKeYPUwYHoPZu7c3J1Pq0ZLto1vt3m+37/D/6Bm/TDosvQYkMZIyxTj4Ndql3xoxD8PrG/t7uR9Ee6vFN48sPJfaFPEX9+m0U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785422868; c=relaxed/simple; bh=f0kOPT7H/Gqnbw36WS//Y2bYGlLTGjPPBZZGt+DipkU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bB1huTOQli2tQU2LGL8EMJKdehCCzLfpD1hzXYRACVQmGqzZV8VEgmkzklLI9aKkX+Yu/CSLDoyghaMVqK+af+DqScZpM9mUa2tIu8PnRiErmC+jah3/hHKNKOqpWMl4C6f+aBZsYrd5etXVvqM3IRu/ToywgAT8ZQLfy0zu1IY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TbA3TXMh; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TbA3TXMh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D96531F00A3A; Thu, 30 Jul 2026 14:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785422867; bh=JqNxr5PgzGFXh1zFL6k/qVHPuXsiqcnut3lUE0uJyfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TbA3TXMhNzeGofyfPd6eiiJaY+uSNjJNSAcf7iS9WrcwysLMwopPH8bTN0TcVxzaI dxn5sgi0UWZGhsCZf2HYwqOkgz9D436x4wR1WcYv1u+0+/j34XEQNzhxNYtKgRi5zE sugeBBwgHv6WNHkS6s4IMcqig41WgZSXFsHLsuk8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Hugo Villeneuve , Bartosz Golaszewski Subject: [PATCH 7.1 583/744] serial: sc16is7xx: implement gpio get_direction() callback Date: Thu, 30 Jul 2026 16:14:16 +0200 Message-ID: <20260730141456.676666332@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141444.267951807@linuxfoundation.org> References: <20260730141444.267951807@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hugo Villeneuve commit af071d9e07e57cfff239e8d09d2f3b05ebc9c667 upstream. 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. Fixes: dfeae619d781 ("serial: sc16is7xx") Cc: stable Signed-off-by: Hugo Villeneuve Acked-by: Bartosz Golaszewski Link: https://patch.msgid.link/20260716210813.2582826-1-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/sc16is7xx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1274,6 +1274,17 @@ static int sc16is7xx_gpio_set(struct gpi return 0; } +static int sc16is7xx_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) +{ + struct sc16is7xx_port *s = gpiochip_get_data(chip); + struct uart_port *port = &s->p[0].port; + unsigned int val; + + val = sc16is7xx_port_read(port, SC16IS7XX_IODIR_REG); + + return val & BIT(offset) ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; +} + static int sc16is7xx_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { @@ -1351,6 +1362,7 @@ static int sc16is7xx_setup_gpio_chip(str s->gpio.parent = dev; s->gpio.label = dev_name(dev); s->gpio.init_valid_mask = sc16is7xx_gpio_init_valid_mask; + s->gpio.get_direction = sc16is7xx_gpio_get_direction; s->gpio.direction_input = sc16is7xx_gpio_direction_input; s->gpio.get = sc16is7xx_gpio_get; s->gpio.direction_output = sc16is7xx_gpio_direction_output;