From patchwork Mon Oct 28 12:49:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 2003275 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=QtSP5Jcd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-gpio+bounces-12231-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XcYD06gtyz1xxV for ; Mon, 28 Oct 2024 23:51:12 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 392DE282663 for ; Mon, 28 Oct 2024 12:51:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED7071DB350; Mon, 28 Oct 2024 12:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QtSP5Jcd" X-Original-To: linux-gpio@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A31681DA100; Mon, 28 Oct 2024 12:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730119857; cv=none; b=CFH4MqhPcdulcyr2kESkNlCUEbfmPxBraK3rIz9TLRKynF1LQUxUrkoeaDjw9M+D9/71KBSfs9lRgw/SF/pGBWubwIZo5ToJpW06coxwAJ5dGIcmTV1J+/p4afUiCSTjuq/V3pBfk/nxIF5tQgU3DjL0Ue3Oe67w0FMdDN6fR14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730119857; c=relaxed/simple; bh=7Ge9yzexlqDrgDbguS0+PqX9Rod1WKkx1jZBzXFlStU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rRDqbkOocERwRz/7l9GnTw8PADxcsK+qaYGppKJtWy/e8natpqnpJT5Fr4rEEU+GvqiedlIkHx/JxwW+wwoipmz1kljN5NhQ5Hiifcd6kPPrDArvNxYH72bwV8s6fZ/7XnB1XQLC8JtIWyJkeaonrQ6akIBe1bwxWPhXbuijgj0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QtSP5Jcd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5702EC4AF09; Mon, 28 Oct 2024 12:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730119857; bh=7Ge9yzexlqDrgDbguS0+PqX9Rod1WKkx1jZBzXFlStU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtSP5Jcduk9xAWbMDpZA3+URbKixIbLhWB1BmfaOfybNkhODBXC4ABFNHrE8daQEf 4EslBBTYM5lkHUKJNd8VXGGpMc2xqZMUMkvEcYOcIkOUTgnZxTFFy+XfCqSPQIE00Y nGYtBWvFxwmVHIJx5Tek/hB3rFEichpVXxHURjksZXspx8gNmOtSm8GJhWTidKjpwK oKBB3V9/iXFro2ooTeD2HxFyfrHCabT9feN8rwbj1l4MQpcU/CvDI+LefJFbcfnhwn KTtKlmLseplvabaONpn2cvN5QMgyvEtiTRk3SbIP2vIEhTgxdMurQwRcVAkCc8zaRR 3sAxE7EOcvekQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1t5PDH-000000006ID-247V; Mon, 28 Oct 2024 13:51:15 +0100 From: Johan Hovold To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Thierry Reding Subject: [PATCH 1/3] gpiolib: fix debugfs newline separators Date: Mon, 28 Oct 2024 13:49:58 +0100 Message-ID: <20241028125000.24051-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241028125000.24051-1-johan+linaro@kernel.org> References: <20241028125000.24051-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The gpiolib debugfs interface exports a list of all gpio chips in a system and the state of their pins. The gpio chip sections are supposed to be separated by a newline character, but a long-standing bug prevents the separator from being included when output is generated in multiple sessions, making the output inconsistent and hard to read. Make sure to only suppress the newline separator at the beginning of the file as intended. Fixes: f9c4a31f6150 ("gpiolib: Use seq_file's iterator interface") Cc: stable@vger.kernel.org # 3.7 Cc: Thierry Reding Signed-off-by: Johan Hovold --- drivers/gpio/gpiolib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index d5952ab7752c..e27488a90bc9 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -4926,6 +4926,8 @@ static void *gpiolib_seq_start(struct seq_file *s, loff_t *pos) return NULL; s->private = priv; + if (*pos > 0) + priv->newline = true; priv->idx = srcu_read_lock(&gpio_devices_srcu); list_for_each_entry_srcu(gdev, &gpio_devices, list, From patchwork Mon Oct 28 12:49:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 2003278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=SJe+s8kT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-gpio+bounces-12232-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XcYD23NkBz1xxb for ; Mon, 28 Oct 2024 23:51:14 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 34CBC2826AF for ; Mon, 28 Oct 2024 12:51:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3E4F1DB375; Mon, 28 Oct 2024 12:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SJe+s8kT" X-Original-To: linux-gpio@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A31C71DA10B; Mon, 28 Oct 2024 12:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730119857; cv=none; b=DyEBbbGQAyvJsYR2JfFhEglSZZlILAQkYTSx6HVE9F3MdducVRo2Q7ksLRNwoKet1dHGA44QDBDmWtDMUPjyZEkwGG7fdmUbS12rAMP9ntV/IX6wb6exQRbxJMbRIoIYwG0u/5sP4+XK1h9IAv0q9WfyAI3tr+8IGWIpxwEBfH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730119857; c=relaxed/simple; bh=ZWkrzQm10QvJ2T3sAn6epItT2KxYcYPw9jk27J4657w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oHLhiLLClvD2Ytff8hCcIzk3Wvb6CX28+ypigzP1w9Q55vSpTosSEv5cqDxp1BziPLAMHN/Hbsm+xu01wf7NsM0s+KhZFnVUP/8nTzJ0l/oOhMUo9CV0xa/WeG9PokTE4po9sfQdcCdYKNAGmIGtP93v3EArStzKRQvUJaCZ3oA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SJe+s8kT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56EB4C4CEE7; Mon, 28 Oct 2024 12:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730119857; bh=ZWkrzQm10QvJ2T3sAn6epItT2KxYcYPw9jk27J4657w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SJe+s8kTUjuIvvmsiuLAzxeq59Hyg/U9Y6Fms9PEJYKrPlPbLW3M/brV5vi3+Gn7k v3s1hMbuO9i1ZEAFqlFXsw4VM2a26kbSxgxLc5UTJPLtS6QLyzpTV0rvaCMWfYzdTy g00gu+salOw1DKMKZvIB0XxzygUR39jwlevBRzSuBoSuUjvKkrEF14iUk98coLn+6r JHfFVEx1N5U1C1PrCULYJWoiElkoWzTIjS0elLugWrGLrWyZDqAHf6aoSlkZezt+e0 aWl5yfWoXNs6CQiHVRoIrbqniDWEODQ8JuOhzTP6kKsAq/vTANTGQeixBLpm+zDULN bJF1H7ybJZk4g== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1t5PDH-000000006IF-2PB8; Mon, 28 Oct 2024 13:51:15 +0100 From: Johan Hovold To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 2/3] gpiolib: fix debugfs dangling chip separator Date: Mon, 28 Oct 2024 13:49:59 +0100 Message-ID: <20241028125000.24051-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241028125000.24051-1-johan+linaro@kernel.org> References: <20241028125000.24051-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add the missing newline after entries for recently removed gpio chips so that the chip sections are separated by a newline as intended. Fixes: e348544f7994 ("gpio: protect the list of GPIO devices with SRCU") Cc: stable@vger.kernel.org # 6.9 Cc: Bartosz Golaszewski Signed-off-by: Johan Hovold --- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index e27488a90bc9..2b02655abb56 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -4971,7 +4971,7 @@ static int gpiolib_seq_show(struct seq_file *s, void *v) gc = srcu_dereference(gdev->chip, &gdev->srcu); if (!gc) { - seq_printf(s, "%s%s: (dangling chip)", + seq_printf(s, "%s%s: (dangling chip)\n", priv->newline ? "\n" : "", dev_name(&gdev->dev)); return 0; From patchwork Mon Oct 28 12:50:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 2003277 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=gBe1H09m; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-gpio+bounces-12230-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XcYD13NFqz1xxZ for ; Mon, 28 Oct 2024 23:51:13 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 01BFA1F21B34 for ; Mon, 28 Oct 2024 12:51:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7CDE1DACBB; Mon, 28 Oct 2024 12:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gBe1H09m" X-Original-To: linux-gpio@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A310D1D9320; Mon, 28 Oct 2024 12:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730119857; cv=none; b=FBrhNxLiyn88oB75rTzAj0t6SAXF6QE8FGdXbqh1zjvJqm6rloRaQNh33jOpYU1llPoyEsUaCAYGCFRlxlEHOx4AdegSpZXSo9QBFk4G6xu/QkQqtdeRVQJNjUlbLZ3xnKFme+kv3hbBrv1dyDngA7GSR7Kcv3YmgSOH5HSTx3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730119857; c=relaxed/simple; bh=UTh5vV7NfMc9FOIu3v2qDvu0CdSUlmtOsGtomT83pU0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HmJTt9DVdihPvatJ3izXW2Qi2r5Qix/SO5pK8TKUDkTsTVC2toqvKRZvUJHqfsFSlZbFjcsgubFsGqLEGNMHRKXjRdvBBNedRV0INh0rwT0L4Ob6uUNd9AnO2R5Vvq7hWQTTjc2mcZJdH7+6SW0IU7Ej3UgY/kwR6g9G7QpSRwg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gBe1H09m; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 574DFC4AF0B; Mon, 28 Oct 2024 12:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730119857; bh=UTh5vV7NfMc9FOIu3v2qDvu0CdSUlmtOsGtomT83pU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gBe1H09mxFtoXhXNL3e2JfpzONznr68XNHim/2HgWOFyGLDmHkrjp1z7ircT/Y+S9 fBCbtcP2SUwFiIZYELOzoaCmmHjQemSSA7xzMyUBHuAsaXdGbd+d1MOjY89HUtKcoY 3UQAAHARZuHrbVnasJOxGq/yddiIdZ4AIauZWzC/xjIjdEigFw4019/jElScv8qqha 9x8FPgJUdgpOy90d1JFP5HYxhBA35xyHhbfpr3C0K/PJS8bxjJvS2BUKEy53CuVn0B 791308Pw1481VX6pC9OgVbvwmvp8mhkvCxZxXTgbM1uEi2yUDcJld87rV8S8pbAflT QqZWn8Q47+9bQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1t5PDH-000000006IH-2mfB; Mon, 28 Oct 2024 13:51:15 +0100 From: Johan Hovold To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 3/3] gpiolib: clean up debugfs separator handling Date: Mon, 28 Oct 2024 13:50:00 +0100 Message-ID: <20241028125000.24051-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241028125000.24051-1-johan+linaro@kernel.org> References: <20241028125000.24051-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add the newline separator before generating the gpio chip entry to make the code easier to read. Signed-off-by: Johan Hovold --- drivers/gpio/gpiolib.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 2b02655abb56..6da73a373d9b 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -4967,19 +4967,19 @@ static int gpiolib_seq_show(struct seq_file *s, void *v) struct gpio_chip *gc; struct device *parent; + if (priv->newline) + seq_putc(s, '\n'); + guard(srcu)(&gdev->srcu); gc = srcu_dereference(gdev->chip, &gdev->srcu); if (!gc) { - seq_printf(s, "%s%s: (dangling chip)\n", - priv->newline ? "\n" : "", - dev_name(&gdev->dev)); + seq_printf(s, "%s: (dangling chip)\n", dev_name(&gdev->dev)); return 0; } - seq_printf(s, "%s%s: GPIOs %u-%u", priv->newline ? "\n" : "", - dev_name(&gdev->dev), - gdev->base, gdev->base + gdev->ngpio - 1); + seq_printf(s, "%s: GPIOs %u-%u", dev_name(&gdev->dev), gdev->base, + gdev->base + gdev->ngpio - 1); parent = gc->parent; if (parent) seq_printf(s, ", parent: %s/%s",