Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1492456rdb; Wed, 6 Dec 2023 23:59:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFI8W+Sgligx5z3e7FkoRPY35+j+W0ItVjiQkG0Ydwe2/BUItq1o2yTE9c4fsnptI5Bc33K X-Received: by 2002:a05:6a20:9192:b0:18b:960a:efc2 with SMTP id v18-20020a056a20919200b0018b960aefc2mr1893097pzd.10.1701935949426; Wed, 06 Dec 2023 23:59:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701935949; cv=none; d=google.com; s=arc-20160816; b=QSFI2P6bNJJA7ouSK+RZH0HAiLxxxlPMYs8Ga3UOBq3ZfENclpHYWkzoYyiYFUwlKN c1Zg3WyGR0J6RXJ2m2aOTR9k9ZLn9CU5+kyKU/Bt4qm124J136luVdb+vTR6Dl/BIlXE UFbssGxPjVe10gh1cm+zcwCy0U7tRmKg6NTY7053ybKI8kdKKmQS3FHKPnw9CzmI1q+I XwM0EoEjK93wj0TQEYYepUMkVKMoFJMG7J7HzUm5W25tzEj8K8TXTB6lAfu7hNW5ZaPV TsZfqo2C7R93xXgycNwGPUdd6fDgOvNRslXqrxJUboXqAlCwJ9vVIvNzX8Lto3+1Os/L nuVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=PD3HPsXbMpNvWmGcN03QUeNavu7XzJ0mobag/cOQb8Q=; fh=vyyh1ZCJj39iLlPzyJsCy9G3/eYXDPriHsE8TX/rDmY=; b=Sn1FkEgLkb793WTuoitc0CAJKkvSffFR45CuQHeBtsQb7yU+0e3351R0FGAtX6kptF QabXF/7clBKAzmWnlsURvK5VXk05j3foeHjSOxR8UXh3iQ2LuF0X5FdU6JLbG5GBZnYp n9S2yPhQurvFbchkM+X/wZBEkF50Wek5vlGN0Ly9/Cc8tLpZ6AbJjV4DGN3C9dObbXT0 qgTVl9MZfHA+xBUYGxomv1JyBYaT1stn0kd7DPN4kzIvtQmmz+lROBNxUEiia6avIkhR LWr8YH+1pVFMjZSFG06IGMMWu3+T0MCkjOyzQk/TCQzLVUOuzaB7T6qFKLjhOGlbQUMu 8eTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-526-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-526-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x8-20020a170902820800b001cfa17ec332si681694pln.616.2023.12.06.23.59.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 23:59:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-526-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-526-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-526-linux.lists.archive=gmail.com@vger.kernel.org" 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 C74FB2830E2 for ; Thu, 7 Dec 2023 07:59:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DFDED1C6A3; Thu, 7 Dec 2023 07:59:04 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0F3F10F4 for ; Wed, 6 Dec 2023 23:58:58 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rB9Hb-0007wI-Ry; Thu, 07 Dec 2023 08:58:55 +0100 Received: from [2a0a:edc0:0:1101:1d::54] (helo=dude05.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rB9Ha-00E8h2-4m; Thu, 07 Dec 2023 08:58:54 +0100 Received: from rcz by dude05.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rB9Ha-00CyIz-0I; Thu, 07 Dec 2023 08:58:54 +0100 From: Rouven Czerwinski To: Johannes Berg , Josua Mayer , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: pza@pengutronix.de, Rouven Czerwinski , stable@vger.kernel.org, Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH v2] net: rfkill: gpio: set GPIO direction Date: Thu, 7 Dec 2023 08:58:36 +0100 Message-Id: <20231207075835.3091694-1-r.czerwinski@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231206131336.3099727-1-r.czerwinski@pengutronix.de> References: <20231206131336.3099727-1-r.czerwinski@pengutronix.de> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: rcz@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org Fix the undefined usage of the GPIO consumer API after retrieving the GPIO description with GPIO_ASIS. The API documentation mentions that GPIO_ASIS won't set a GPIO direction and requires the user to set a direction before using the GPIO. This can be confirmed on i.MX6 hardware, where rfkill-gpio is no longer able to enabled/disable a device, presumably because the GPIO controller was never configured for the output direction. Fixes: b2f750c3a80b ("net: rfkill: gpio: prevent value glitch during probe") Cc: stable@vger.kernel.org Signed-off-by: Rouven Czerwinski --- v2: - remove the if clauses, the gpiod_direction_* functions can handle NULL gpio descriptors. net/rfkill/rfkill-gpio.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 5a81505fba9ac..4e32d659524e0 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -126,6 +126,14 @@ static int rfkill_gpio_probe(struct platform_device *pdev) return -EINVAL; } + ret = gpiod_direction_output(rfkill->reset_gpio, true); + if (ret) + return ret; + + ret = gpiod_direction_output(rfkill->shutdown_gpio, true); + if (ret) + return ret; + rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev, rfkill->type, &rfkill_gpio_ops, rfkill); base-commit: 994d5c58e50e91bb02c7be4a91d5186292a895c8 -- 2.39.2