From patchwork Fri Jan 26 10:49:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGFsIFZva8OhxI0=?= X-Patchwork-Id: 192521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp574803dyb; Fri, 26 Jan 2024 02:50:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFT9DJS/naTtMzAZrWJwB1qd0N3SUGfioFBmCKB+7Bu9q+ypwx1wFJvk0nPGz8B9kSMQneE X-Received: by 2002:aa7:c383:0:b0:55d:31fa:5e9b with SMTP id k3-20020aa7c383000000b0055d31fa5e9bmr331249edq.39.1706266209363; Fri, 26 Jan 2024 02:50:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706266209; cv=pass; d=google.com; s=arc-20160816; b=BhbZVZktAX9U3zKTluN0m34rSS9VLNyTcdh89x5OwislKYidH0kzGUpn5j6AsR7X6n C1JD9XwgmIjMv2a6SiC4z1HPOrathF1OWXqS04vbjq4DnQljaju++VKC9WIdx0Pj6qIq Q4lLJ0Hp36+XB5Gbjt1uNhlFx3FQlETdNEeQQfu6V6FrH0sdLUKFxIbUWFZPmUN0wjh5 vsVyb6/trkrNcpUVRKq8qPDBTtx8Na3InHtAwN26OppU2/iaIPA/GOGhIG+RUS1987jT 3iHBFprL6Ve5kX0PMl4MTSIPuvGbp6Vx5Ra8RzY0+dTVV10ewnMsYONwMJsyreKg1zIX nh+w== ARC-Message-Signature: i=2; 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:dkim-signature; bh=NuAQ3P3OcHowxwqmPPTvuYfMUdpPDuv0q5L9YgWTHz4=; fh=7V0QjrE2PdYgo3QNbKCnxnHzZ6KV3wVfHIfe6AicRJ8=; b=XkUOwYP+9fWityBMX8mHbjZ7F5Rc/mqAIMNouM/qryZjjrjTLmIj/85LVUfilCBiSR eko1Fabo1KF9dJH37bVR4ufXZWuWVP1+0ris8WBCNMlotub+QASYYxgX1iLXeF0NpPRE Q6QXDjiXUfsplEISmPPNUzctuYMESOoaEcBRigEzTWsLGx37CXHzkWZotE+rm0oj3280 oqitmaTdVbrVUXYjk0DcjAWCscIWasGVwi15lEuLZGIVNM9CUHBp4J3Zr5U0U0WnbC03 uIpOCIF2H6i5BcwYxjDqnxg6XmvfCp08jXaaQ4uAfIQ41fA6rx3A0uNiRqgSJCdh2yNx 0xUA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ysoft.com header.s=20160406-ysoft-com header.b=BIHv0kK5; arc=pass (i=1 spf=pass spfdomain=ysoft.com dkim=pass dkdomain=ysoft.com dmarc=pass fromdomain=ysoft.com); spf=pass (google.com: domain of linux-kernel+bounces-40006-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40006-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ysoft.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b11-20020a0564021f0b00b0055d3916b7d9si275016edb.346.2024.01.26.02.50.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 02:50:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40006-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ysoft.com header.s=20160406-ysoft-com header.b=BIHv0kK5; arc=pass (i=1 spf=pass spfdomain=ysoft.com dkim=pass dkdomain=ysoft.com dmarc=pass fromdomain=ysoft.com); spf=pass (google.com: domain of linux-kernel+bounces-40006-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40006-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ysoft.com 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 F3EF81F2817A for ; Fri, 26 Jan 2024 10:50:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35F5013FED; Fri, 26 Jan 2024 10:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ysoft.com header.i=@ysoft.com header.b="BIHv0kK5" Received: from uho.ysoft.cz (uho.ysoft.cz [81.19.3.130]) (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 01CF5D30B; Fri, 26 Jan 2024 10:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.19.3.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706266184; cv=none; b=ZJDdkeubxyU3ODCEd0aF5Qz0NqkjDbGN8aL9iBmWrwuBKCA4eJyVuT5UQj9gAw3LNDyuwMY0iNqwYv8Cu4Oveu7OEk8I8OyN6hATv1xjqBj0n5fd5rnZNPZogQUXvGXRKA4Ho/CPogY1XnLls/IkhIO1aMZHhw9BbmjsAb3TZSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706266184; c=relaxed/simple; bh=E1yEn/F9bwmHLCpl/6OPcGlQhqadbJlj7TMLIPNylCw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=kiGhcEOU7a6O2sjD+Iemk747vNA4NeQl7b0NpfSEj0zd/LhbV1IOM1EIIBbUsCnMbmRW7/LAoEDqbauUCNZZlGrsUcwSMVpODxO4nsquGkFY6veOB0qbzZ7JvMVWm6fIEqPtD0xJ2BbLwfT1VHtNxklf25kiWZ7WnLSvqJcreMI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ysoft.com; spf=pass smtp.mailfrom=ysoft.com; dkim=pass (1024-bit key) header.d=ysoft.com header.i=@ysoft.com header.b=BIHv0kK5; arc=none smtp.client-ip=81.19.3.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ysoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ysoft.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ysoft.com; s=20160406-ysoft-com; t=1706266180; bh=NuAQ3P3OcHowxwqmPPTvuYfMUdpPDuv0q5L9YgWTHz4=; h=From:To:Cc:Subject:Date:From; b=BIHv0kK5nwyMwURrz4dVMfTbofViqg3lnGfaLM1byyEJ6ESIHIg5+VnSkQViOgU0A CTYfXwjzYAbPFd86zm1cY1ncKC0xZoQIkh5pX+Q6/4+OitBt+MGQt+iHU+11f6S+Ko du0wTlbHMaD3qAdfuv9RTeAshoUm3GvSSmh6gFE0= Received: from iota-build.ysoft.local (unknown [10.1.5.151]) by uho.ysoft.cz (Postfix) with ESMTP id 9B060A0717; Fri, 26 Jan 2024 11:49:40 +0100 (CET) From: =?utf-8?b?TWljaGFsIFZva8OhxI0=?= To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christian Marangi , "Russell King (Oracle)" , =?utf-8?q?Marek_Beh?= =?utf-8?q?=C3=BAn?= , Christian Lamparter , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, petr.benes@ysoft.com, =?utf-8?b?TWljaGFsIFZv?= =?utf-8?b?a8OhxI0=?= Subject: [PATCH net v3] net: dsa: qca8k: fix illegal usage of GPIO Date: Fri, 26 Jan 2024 11:49:35 +0100 Message-Id: <1706266175-3408-1-git-send-email-michal.vokac@ysoft.com> X-Mailer: git-send-email 2.1.4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789149797078630675 X-GMAIL-MSGID: 1789149797078630675 When working with GPIO, its direction must be set either when the GPIO is requested by gpiod_get*() or later on by one of the gpiod_direction_*() functions. Neither of this is done here which results in undefined behavior on some systems. As the reset GPIO is used right after it is requested here, it makes sense to configure it as GPIOD_OUT_HIGH right away. With that, the following gpiod_set_value_cansleep(1) becomes redundant and can be safely removed. Fixes: a653f2f538f9 ("net: dsa: qca8k: introduce reset via gpio feature") Signed-off-by: Michal Vokáč Reviewed-by: Andrew Lunn --- Changes in v3: - Keep line length under 80 characters for netdev changes Changes in v2: - Remove the now redundant gpiod_set_value_cansleep(1) call. drivers/net/dsa/qca/qca8k-8xxx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index ec57d9d52072..c247ab09874c 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -2038,12 +2038,11 @@ qca8k_sw_probe(struct mdio_device *mdiodev) priv->info = of_device_get_match_data(priv->dev); priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", - GPIOD_ASIS); + GPIOD_OUT_HIGH); if (IS_ERR(priv->reset_gpio)) return PTR_ERR(priv->reset_gpio); if (priv->reset_gpio) { - gpiod_set_value_cansleep(priv->reset_gpio, 1); /* The active low duration must be greater than 10 ms * and checkpatch.pl wants 20 ms. */