From patchwork Wed Jan 24 11:37:04 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: 191507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp927194dyi; Wed, 24 Jan 2024 03:38:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGHVGTXWs05kMU/iMBv9IoFMaLxLVF7BtW9DYPRpXC3QWHKGjRCpzUU/BE2G+m7xMXhVkeo X-Received: by 2002:a05:622a:344:b0:42a:5d99:bcab with SMTP id r4-20020a05622a034400b0042a5d99bcabmr789483qtw.109.1706096294961; Wed, 24 Jan 2024 03:38:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706096294; cv=pass; d=google.com; s=arc-20160816; b=C3x7QiXwin+lFR4PbAFluvATLHDbnRl9Ma49EQsXQqlJtgj18emAlfGQz+qktACuvf CWG44hUUjJVx+TbzmRCTR/OJox7mCDD8oy8wtDOaFGzuF07U56fgyqW46enrWEVH7ZpG 9lW8EC2dWtk11n0zxrtC8S3VGOt0/2pLpKkjAsDcTdNg233Xmonm8LVcakMJ6D4YGwBh snscrl3+HFcAbdRW3EsBuC0vF+WgKMMrHUYMu/r6d3/4M29ujAfzsJd36ZdIlAjWRRq9 LXZHlZHQOtTFvahK1zVektrYiK84U7AocKG0r86IsHy1GhAz/A7OePfYZLg65Ozso3Kj KIrw== 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36882-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ysoft.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v20-20020ac85794000000b0042a598ee5cesi1996656qta.275.2024.01.24.03.38.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:38:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36882-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36882-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BE8051C20D04 for ; Wed, 24 Jan 2024 11:38:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E76B71B7E5; Wed, 24 Jan 2024 11:37:59 +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?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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788792576523442581 X-GMAIL-MSGID: 1788971628596242912 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. */