Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp963704rdb; Wed, 6 Dec 2023 05:13:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhid84NmIbVzdOYP60bbB43BKvttob3er7bjF0Ahc1hz6jmsOqesyH7v9+BGIR+36H/97V X-Received: by 2002:a17:906:2dc5:b0:a19:a19b:55dc with SMTP id h5-20020a1709062dc500b00a19a19b55dcmr607050eji.108.1701868433744; Wed, 06 Dec 2023 05:13:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701868433; cv=none; d=google.com; s=arc-20160816; b=jQ8qF6ndhWfI4Lys4dPsxfW65WeACYjZBWIxDuSNMHp5E8/tvCNZSxvjNofzAntBzJ BjqRtMlMadEv/k9YMm0xhsBgHb9Ve4IyqsLbfNbFZCcp6wjM2Pl2DoqQMQEzPlJEGIZU AjDCMMZOdPN9nd8kMFufi4RoxHtLoH8Phf7okjs5zTnoLVrh5RoNxW1b1Ax4t9EQEZTd AQm7TNYf88MCyXID9hZ9ze1XjxLQeRNdt0E1RcwRWn/XrNoJ2WMMJVTEu/v8vJdfjxzb YY0lLTAbwIlThrdwGrMdBWk3OJ/v/sbjoXy749t5LMUrGWEIIK3P2n4BLM2G5ux+3hr6 KDNw== 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:message-id:date:subject:cc:to :from; bh=K23DuCWgsXDvwZDOSUrEHVYJoBnpk2dj1aZqpumcPD4=; fh=fQ+/VrkWe4z8y7xbwtkgzLrdKvh28T4DgaUt22Pngo8=; b=A4WCzbTwbXuPVE3n1lJaYCI5tZT0RSH+7IVFd7fnmX9A/djDgThR+b7sVhF6cCucDw IrZscPKgW+ZVZPKf5Y0NXlRX4ybFrKHZSkkrqi+KMOLl/5Wxh5VKh5Srb7gCDhYT6ucY IB+x4GiL/KYISM5Q8A3YOG6+D6SWM2k1Sr/2Lx5W7ws0FN/IQ0ffaKCPJYXnmDtInwJ7 7ysaG0rJAfkSKv+9mkHfoKIkknow7+DryE/imEBesrHlv52p6XFxoS8ofQPwP/xpJaOj K982OfBbz7lWRSmpxkgnquQgO5wK9zUzFAA8Em+qtVtwS9pboPryw2VTFvfjsf+ckwXz jyxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-497-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-497-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qw41-20020a1709066a2900b00a1db7922c75si596356ejc.608.2023.12.06.05.13.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 05:13:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-497-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-497-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-497-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7F0BE1F2142F for ; Wed, 6 Dec 2023 13:13:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7843374EA; Wed, 6 Dec 2023 13:13:50 +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 F1FDBAC for ; Wed, 6 Dec 2023 05:13:46 -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 1rArii-0001DV-2f; Wed, 06 Dec 2023 14:13:44 +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 1rArig-00DyO1-MO; Wed, 06 Dec 2023 14:13:42 +0100 Received: from rcz by dude05.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rArig-00D0Qc-20; Wed, 06 Dec 2023 14:13:42 +0100 From: Rouven Czerwinski To: Josua Mayer , Johannes Berg , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel@pengutronix.de, Rouven Czerwinski , stable@vger.kernel.org, Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH] net: rfkill: gpio: set GPIO direction Date: Wed, 6 Dec 2023 14:13:35 +0100 Message-Id: <20231206131336.3099727-1-r.czerwinski@pengutronix.de> X-Mailer: git-send-email 2.39.2 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 --- net/rfkill/rfkill-gpio.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 5a81505fba9ac..3d9ae696397cf 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -126,6 +126,16 @@ static int rfkill_gpio_probe(struct platform_device *pdev) return -EINVAL; } + if (rfkill->reset_gpio) + ret = gpiod_direction_output(rfkill->reset_gpio, true); + if (ret) + return ret; + + if (rfkill->shutdown_gpio) + 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