From mboxrd@z Thu Jan 1 00:00:00 1970 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 4FA212D051; Fri, 5 Jan 2024 14:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eoJUkANj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C530DC433C7; Fri, 5 Jan 2024 14:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1704465585; bh=SO30nGvxqJwXkpOSYQZNbT6ocwbyojX8bK66nRrlnCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eoJUkANj2dZ2Jt2XRVN00lxXaySy92WmUFNO2Mik7520Ff+GGOpiFHdV0YmREaQIT gQybdAQvUgtcjrq0mHiYqDNMPzG7nEm6+p4odVvWE2khY2BEu0UxEF5Y0WQ+WGcJ8R naM/QQshyeIzWGyCKPsereVT2N0mMj9ffZPXsWWc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rouven Czerwinski , Johannes Berg Subject: [PATCH 4.14 19/21] net: rfkill: gpio: set GPIO direction Date: Fri, 5 Jan 2024 15:39:06 +0100 Message-ID: <20240105143812.394635143@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240105143811.536282337@linuxfoundation.org> References: <20240105143811.536282337@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rouven Czerwinski commit 23484d817082c3005252d8edfc8292c8a1006b5b upstream. 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 Link: https://msgid.link/20231207075835.3091694-1-r.czerwinski@pengutronix.de Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/rfkill/rfkill-gpio.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -129,6 +129,14 @@ static int rfkill_gpio_probe(struct plat 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);