Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1054737rdb; Wed, 24 Jan 2024 03:38:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+6DQsRm+v6dtDC7NZ3muF2rz9ZLX2jMPmOexUKV5WdGFSI8qeSnGEusff1RgZrfdeIV3+ X-Received: by 2002:a05:622a:1909:b0:42a:5952:6107 with SMTP id w9-20020a05622a190900b0042a59526107mr1487995qtc.100.1706096286977; Wed, 24 Jan 2024 03:38:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706096286; cv=pass; d=google.com; s=arc-20160816; b=e34bvM8lpAwEkzEIYoOC9c1ma9x43/JZKQ98dwxiH0J3Y0hnDRhIbt1oAJNJLdV+kH NHTZ9Cai4h8Usk5Ca/GJjJxuDUqwBu41HRp60/UobE3dN/cmbdpgF3DLdKNhTscyEW7V nX3dFu/aYtrab6CNBupKJNGYXoWJkEx6r80hi7EfNJchjC4hlvS5Y6f2pZoF1iUTh3Sw Cu7Fuk10sd5S5zddzZP6wu5Vs18629CR0Z6jsw6vluq8Pv24RtBZLLXEYNfOOX5HszWA p4LFE29qsWDqoCsH3QZwH/LGEcHMShutAG4kbQ7/iSSYsa9zjCNgEDNkkW1dmHKZ9mPJ Xm3w== 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=RCaHE0tC3khu9dAk+5tzPS8eeRLwaUKDTUQ372q36T8=; fh=7V0QjrE2PdYgo3QNbKCnxnHzZ6KV3wVfHIfe6AicRJ8=; b=vBTWGabeOcLauJjqfc9i6B3jj8cj+Up3yhbAdLoVfC6qWjkBZ1GTiPMeV/55hB7S0H wFaKvQFtZeUni62GwUIDNoj7dA0vQvhTQGsNMlAu2ROicTC8odWWiZ3g+alPVz/9KHHc ocHkipbHueFlMQmSqDcH1Gn1N3EUf7myvOiQSxDXmKt+b/5W++KLR5dGpCTVo6DfQ7ij /BC7XcWsPnv/UTLPkfgNYx8ed5skeqNGEqIrM6M0ornL4aMVc4tc/U9Kx+iVdQvIGoII 2ceWyCH4ezSR+Insi0QVr+1Kv7oY+APNeSUwK0KSCyY4DrNhDIAqwqFmEDzoMyrVtEy/ HCOQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ysoft.com header.s=20160406-ysoft-com header.b=VczUFGy8; 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-36882-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ysoft.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k13-20020a05622a03cd00b0042a09eb9551si10343974qtx.561.2024.01.24.03.38.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:38:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36882-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ysoft.com header.s=20160406-ysoft-com header.b=VczUFGy8; 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-36882-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36882-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BA35D1C208E9 for ; Wed, 24 Jan 2024 11:38:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 190691B297; Wed, 24 Jan 2024 11:37:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ysoft.com header.i=@ysoft.com header.b="VczUFGy8" 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 AD60E2C684; Wed, 24 Jan 2024 11:37:55 +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=1706096277; cv=none; b=CZV8O9lDAXtsxaUNuf7W07RdIglgrWXC6c9+6PDqYioQtNefcMw2MMEhNs1Rm9BCFS27zamcgkNxJR93O7mgpxadIy5VAITNFH/z7sggDtZyay9F0Z7oNYW2dj1b+9kYNSiwITYgA9UXSda13iO9N9JAB942yzoeGbKoDFB7eiI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706096277; c=relaxed/simple; bh=XIsLLG2ZFt0geBQkPbktDRQpYOT8D9Qc0zub56ZzOiA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=NYPKXvuFzfEBaQIo6eGnqoZwQqIkeXrDVaSQSppN1SwmFrULUKfMabungqz+zBCLaTRF9I6x7H8R51rUTd4X0yeRYGGGROWHyA4VANSN7waoBOQ2ZPYrsWtLSOBLW5oo35zjrxZNWmv1zK4SVYR4oo8UuzU2lCD5UKBFQqDlcvg= 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=VczUFGy8; 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=1706096273; bh=RCaHE0tC3khu9dAk+5tzPS8eeRLwaUKDTUQ372q36T8=; h=From:To:Cc:Subject:Date:From; b=VczUFGy8q6fADu33Zhmykpkrai+NufFHS2fbkU+lKfW2Tkcr1iSnGqsg/UngczZ8l A1k/gAQKoFHuOC4fxct9l1xciJvJ/l7U/+pO7jg68ZwaSj7wpyZiEQ3Scy2b+Jdy9Q YZkgMX/cH7g6jk4gWc3PXZW2j7HQdaKemqXbs9sU= Received: from iota-build.ysoft.local (unknown [10.1.5.151]) by uho.ysoft.cz (Postfix) with ESMTP id 335E6A047B; Wed, 24 Jan 2024 12:37:53 +0100 (CET) From: =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= 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=20Beh=C3=BAn?= , Christian Lamparter , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, petr.benes@ysoft.com, =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= Subject: [PATCH net v2] net: dsa: qca8k: fix illegal usage of GPIO Date: Wed, 24 Jan 2024 12:37:04 +0100 Message-Id: <1706096225-23468-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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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áč --- Changes in v2: - Remove the now redundant gpiod_set_value_cansleep(1) call. drivers/net/dsa/qca/qca8k-8xxx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index ec57d9d52072..3663de8f2617 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -2037,13 +2037,11 @@ qca8k_sw_probe(struct mdio_device *mdiodev) priv->dev = &mdiodev->dev; priv->info = of_device_get_match_data(priv->dev); - priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", - GPIOD_ASIS); + priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", 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. */ -- 2.1.4