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 9B1912D051; Fri, 5 Jan 2024 14:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="YpO8Og3C" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D322FC433C7; Fri, 5 Jan 2024 14:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1704465733; bh=vlX7q3v42PE0CmjBv5Rka2VIHMu0bDy0DOvaGJUL/64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YpO8Og3Cn7TCBh6HE5Qfg+TuRlmja/LPAU9vx092gl+2KhXrphAeuj3P+vuJD4WXH xDIIi3RLrYJ0xQnjuMQrXH1wnncCUbUi/zELKKHd3UOc+PamT2o3gUlyejzr73ivbR BxCjJNvxX0gvvqzI4D9/tOR4Bni1/WEKp0wh5SN8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rouven Czerwinski , Johannes Berg Subject: [PATCH 4.19 35/41] net: rfkill: gpio: set GPIO direction Date: Fri, 5 Jan 2024 15:39:15 +0100 Message-ID: <20240105143815.381738401@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240105143813.957669139@linuxfoundation.org> References: <20240105143813.957669139@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-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 @@ -130,6 +130,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);