From nobody Thu Apr 2 09:14:09 2026 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 1ABB32405E1; Fri, 13 Feb 2026 09:31:08 +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=1770975069; cv=none; b=LHfO3YBhUGY9kh0usYJewAHX9La7HlxuwrM0efjKWHH573uCKTmTl1KEg5QgTLjczzKYjoU4qXFyHkWuSjHwC/c03Uo7ycBxmLjqur4eygiEN6ILZIoMd8RnGLIBWVI//LJA42rwYJ5/B2AQlTQcNcEYqdxUrN5GfAboNsrRKvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770975069; c=relaxed/simple; bh=3yaZTDOU24FAmuSSempbk58vZlgrqTM2zntQtT1Ib4E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G+0IQKBUNMlVI5m8UOtWfnUhvv8+7Yq6YWAhy0GHi7IV6fvK+GvWnu82F6XI+AvVFujV+GmWPm3gCxTdhy6DpShf9qr9OfwwL4dg6cKi5g21Pxl4t/Dg6miSaxXSBrqzOgJR8oEvj3cbehuVT7qUzwGcKN4HtFQ+jECZWMfaqOM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rOnY1kvt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rOnY1kvt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03780C116C6; Fri, 13 Feb 2026 09:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770975068; bh=3yaZTDOU24FAmuSSempbk58vZlgrqTM2zntQtT1Ib4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rOnY1kvtyzQdttQc8WZ7zlLqC0XJZb2WGgJU93EhUhrjx7vFftGlg0srUuv8tQPuz qwLWAiLVVEhtj8B3gM6l5jyGmK0wQA/S85CAUOHjVUuZ7kmqiISFcTvGpDtzsw9xfJ VY4/jdoYCkO6Jn2R8seaQcVxsqBrEKeyNkY+slousU/VPpVP6b05hXIL9UQo0B0b9F 5aYIunzOx4g3PLurZTlJef5RzTSOOT5yeH9Wl4eqaxkOtlnMlxLgSwTBpMblgp/BMA smehyXSLLWvA8MTSsmG2G3QgNvravfw0RTUzyXnb7oBhJHOf5VMOli1v7GTYfI3t62 YnYJPKYtuFFXg== From: Tzung-Bi Shih To: Bartosz Golaszewski , Linus Walleij Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Jonathan Corbet , Shuah Khan , Laurent Pinchart , Wolfram Sang , Jason Gunthorpe , Johan Hovold , "Paul E . McKenney" , Dan Williams , chrome-platform@lists.linux.dev, tzungbi@kernel.org, linux-gpio@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 02/11] gpio: Remove redundant check for struct gpio_chip Date: Fri, 13 Feb 2026 09:29:49 +0000 Message-ID: <20260213092958.864411-3-tzungbi@kernel.org> X-Mailer: git-send-email 2.53.0.310.g728cabbaf7-goog In-Reply-To: <20260213092958.864411-1-tzungbi@kernel.org> References: <20260213092958.864411-1-tzungbi@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" gpiolib_dbg_show() is only called by gpiolib_seq_show() which has ensured the struct gpio_chip. Remove the redundant check in gpiolib_dbg_show(). Signed-off-by: Tzung-Bi Shih Reviewed-by: Linus Walleij --- v3: - No changes. v2: https://lore.kernel.org/all/20260203061059.975605-3-tzungbi@kernel.org - No changes. v1: https://lore.kernel.org/all/20260116081036.352286-8-tzungbi@kernel.org drivers/gpio/gpiolib.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index f4dad3e5b5a3..1a3fd7600835 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -5313,23 +5313,14 @@ core_initcall(gpiolib_dev_init); =20 #ifdef CONFIG_DEBUG_FS =20 -static void gpiolib_dbg_show(struct seq_file *s, struct gpio_device *gdev) +static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *gc) { bool active_low, is_irq, is_out; struct gpio_desc *desc; unsigned int gpio =3D 0; - struct gpio_chip *gc; unsigned long flags; int value; =20 - guard(srcu)(&gdev->srcu); - - gc =3D srcu_dereference(gdev->chip, &gdev->srcu); - if (!gc) { - seq_puts(s, "Underlying GPIO chip is gone\n"); - return; - } - for_each_gpio_desc(gc, desc) { guard(srcu)(&desc->gdev->desc_srcu); flags =3D READ_ONCE(desc->flags); @@ -5442,7 +5433,7 @@ static int gpiolib_seq_show(struct seq_file *s, void = *v) if (gc->dbg_show) gc->dbg_show(s, gc); else - gpiolib_dbg_show(s, gdev); + gpiolib_dbg_show(s, gc); =20 return 0; } --=20 2.53.0.310.g728cabbaf7-goog