Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp778156rdb; Tue, 23 Jan 2024 15:08:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSEQkCpqTbALmrsOjLmtRceGlbLYhlc5gxoPFaFweZ7AnNfMuOB+IFJ5ChSqeQhNKm8Yds X-Received: by 2002:a05:6870:f213:b0:210:ae5e:917d with SMTP id t19-20020a056870f21300b00210ae5e917dmr2141682oao.70.1706051282344; Tue, 23 Jan 2024 15:08:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706051282; cv=pass; d=google.com; s=arc-20160816; b=gH4spEmdszr0/WLmzr3TntjczTjN7vTBBA1Vjy0ziq4I0ge9IMHq6eYB9R8qpHHqpl VyOcnE6wNBA4B+ux7xZC8ypoGwRIB5ZCBoTFoph/OZ12WyPE9StBtbN6vT5FFZ/KkwL9 7FF+X50Cu5BC0q6xZwaUUDJxJTmPPaqt0yuYxOHXmi3jJ/9/j95Adgy8i7fB/+ha0A2u h6SxRTYMn2Lho2TdoURyQzROjGmVdpLCtkMxb1J9f7kG6xwhyVHKYNgEyUAghEZwM5uK lkdImrNL4hupgy26qz1xK8aEXL8CS2Tcz0tH2V/vu8zG1n83gDIwe/VuHZGjD6jmnvxm RmvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LZZ7dIkzvXVF+O0UaEUz1mN+3JIr0400uS5HJQS+H80=; fh=H7/koLhZrEnS92JaqbfIxIU9aUJ8lFUnOPD7sxjI4/E=; b=Nn+jzrbT9pKAqJzb59TMhEnGmwUfmeXOwKRu5YoznN4Sb48FNPubLkXtyutOw8h7SJ VWr2f8odvcZYk6cEEHGB8dxOl6EpF+NDQgYDIrLeyLZFOotRBOCKoAXTZ87/DBUZ7qdh ZPd0QnK9H7B9slE0bF5EDscxY5PTxdb/v65h4MGWdHS6q3KmVwu0VoN2TnHy4LFy0++n awVEBtxE86Txoh4oyKrvf+S+acaYyc+BBZQxrHUYCNk7VdF7s3OIXlS7JyPyETu5Vc/G 7w2gssloIee59lcfwL8uwDltjhn85Epcv6TOklZsp/7iew2B38A6UgXxifv7CW+cUGCV iQmQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=qgkjjYHe; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-36165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f13-20020a05620a408d00b007838dcd6c25si9670156qko.399.2024.01.23.15.08.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 15:08:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36165-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 header.i=@lunn.ch header.s=20171124 header.b=qgkjjYHe; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-36165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch 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 B981B1C2309D for ; Tue, 23 Jan 2024 23:08:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EC9853E33; Tue, 23 Jan 2024 23:07:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="qgkjjYHe" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 BF8CE210F6; Tue, 23 Jan 2024 23:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706051270; cv=none; b=Ai6zJLn4xhY1fM17XMjjBOGfU5bTsKKBCxUnUy01fnI9Ii4zcokd6wNzBp1aSLUcI0bD7Q6NtH/ft1vZG7SdRdnFJxbxYPNg8kXOTIc7eDFgTWcBAN05WGMkpYX2PIwZ2/vS3rmNfshOVRUT7mDxByhjtkl7xj/WF77sjb8VW70= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706051270; c=relaxed/simple; bh=EF01pwf93jkw6zcgML//uN79n7gsoLCTDyk3XMANbsk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gycRRVdkSDxaW9akkuaGr1Ibx2f37kb9lxoG6oxmYSFwshY7t56DQYM0MDpFpXAYOzhOItSLb3ZuiwEtse9IUAWUCLtNEAVi2T4Uh2SY4N6vWzhWd4Mvl81nvCmJ6NRYTlEIvtMdHd3BKiInNuzeVXr1bAxFq7PZLq5wIVODSa0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=qgkjjYHe; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=LZZ7dIkzvXVF+O0UaEUz1mN+3JIr0400uS5HJQS+H80=; b=qg kjjYHeJxSBG3x262DYoZzND/Jb4HsUTj/VBsNGjbw2WGpe7iYlu7wGpCND/Y9E/rhux1yt5wZiTaa EjBZpn+SH0gc6pRxEL8Qy8gEyrm3oVjmrRZgeH+QWcXqWtlMa+rr7bIIkrbMQEV8Sxq0NyO/Fgdlm aquDAS16be7fs+U=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rSPrh-005t3R-UQ; Wed, 24 Jan 2024 00:07:33 +0100 Date: Wed, 24 Jan 2024 00:07:33 +0100 From: Andrew Lunn To: Michal =?utf-8?B?Vm9rw6HEjQ==?= Cc: "David S. Miller" , Florian Fainelli , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christian Lamparter , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, petr.benes@ysoft.com Subject: Re: [PATCH net] net: dsa: qca8k: fix illegal usage of GPIO Message-ID: <82712052-e7e6-414d-9c11-5595e0d6e097@lunn.ch> References: <1705925049-5756-1-git-send-email-michal.vokac@ysoft.com> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1705925049-5756-1-git-send-email-michal.vokac@ysoft.com> On Mon, Jan 22, 2024 at 01:04:09PM +0100, Michal Vokáč wrote: > 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 result 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. > Fixes: a653f2f538f9 ("net: dsa: qca8k: introduce reset via gpio feature") > Signed-off-by: Michal Vokáč > --- > 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 4ce68e655a63..83b19c2d7b97 100644 > --- a/drivers/net/dsa/qca/qca8k-8xxx.c > +++ b/drivers/net/dsa/qca/qca8k-8xxx.c > @@ -2037,8 +2037,7 @@ 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); Hi Michal So the current code is: priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", GPIOD_ASIS); 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. */ msleep(20); gpiod_set_value_cansleep(priv->reset_gpio, 0); } Doesn't your change make the gpiod_set_value_cansleep() pointless? Please extend your patch to remove it, maybe extending the comment a little. Please also make sure what v2 Is Cc: to the qca8k Maintainers. Andrew --- pw-bot: cr