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 BE37044683D; Thu, 30 Jul 2026 16:09:26 +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=1785427767; cv=none; b=Lmz9i5M/p4vrAo/c1gXvmgI0OT9fRHVOkNn+uW6RnYR7v51Qf94g84h5nVtlRO6W8pBJmz83gWYVw4GjESfNXwynNGJcmflVo25x8gxiJq8Ms0Cy1Vq0GYnZ0f40dGotAvf+1b6Q6Df4fFTYQcWBgJRz38iwtEGQ5e1lpmbf0H0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785427767; c=relaxed/simple; bh=lxoi5Rc6m258ETB7fvD00MoGkHcGPWqtGr2Us7jQn/M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OtCpuTp56fZQUnB2fs4c8EbQfWPBirb6kyIld0/cU/pzy/cZkqNT1hcKbwlsuwcjRHUKrz9/R63mBMXviYlNBvuTS2wKpohhVfZxrrbtHHNdShT8a/gmnN4l0jPyztyWPtMJDGo7KkJ3f6fnLW2PhOJZvqp/VXqqvDfSfnok8nU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R81Shj1R; 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="R81Shj1R" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 258F21F000E9; Thu, 30 Jul 2026 16:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785427766; bh=coqBCFxi2mhSoWeuKEK/DhekC3HcSJN72MZGFKxbdLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=R81Shj1RBAM//Bp70xs9XKMDK3NgFHhn8xtjEYzuMf2CUf83x4HIWW4Q8Qmk0d2rq uSORJ2TYFSPxnWFKHLWCc3LX0H3bsLB76cuRCXbazYK14gwnU6ZyU6S86cUnRE+oCf QDYq71vRpC/3gUz373o/SrxEnnBjRQtWL0QxmHnw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Hugo Villeneuve , Bartosz Golaszewski Subject: [PATCH 6.6 287/484] serial: sc16is7xx: implement gpio get_direction() callback Date: Thu, 30 Jul 2026 16:13:04 +0200 Message-ID: <20260730141429.730709945@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141423.392222816@linuxfoundation.org> References: <20260730141423.392222816@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 6.6-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 @@ -1308,6 +1308,17 @@ static void sc16is7xx_gpio_set(struct gp val ? BIT(offset) : 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) { @@ -1385,6 +1396,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;