Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1837356rbb; Tue, 27 Feb 2024 02:51:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW8ZEVjQR6VpzWgq2A88qz82FtVYyELHhpLLhbEh55PA1tulLAZAUxmGRM75PX5LY8gn8YAtYntGOK0reH9AfB1N/4al23a180k0kEZMA== X-Google-Smtp-Source: AGHT+IH6Y1AKoYttUTbfEMkvjv/omPhz4xI9HpIxIDZli8Pjt70bB1b0oGiIu0pFK9RWdv1bWpse X-Received: by 2002:a05:622a:ca:b0:42e:a4bd:4254 with SMTP id p10-20020a05622a00ca00b0042ea4bd4254mr61574qtw.26.1709031107086; Tue, 27 Feb 2024 02:51:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709031107; cv=pass; d=google.com; s=arc-20160816; b=aH656zIXAT4s9h3deUt1n/RcSqHCP6/FIxvxRFOMSXPvt1c4HnN2F98LIhylSg/HvM sFhXRCDBBmjH4wB+8JhfV6zJ71Zu6mFUL4bsdkI4Trug4ZPmyxYGhWmEjbsedc2vT7Z7 SK6HGSSZOG8+iQU1c0Ajj+U/q0qXD96VhwyTo7EL9evWUPq62FH3fyVFbHr8VOI36WGQ Gh+BIcUfb1CkzqC7Khv3OOJl8MEOkfTaW7XFjZdfqYKpCvKkgGzJjPV1n1ykc0g0VFja xQBX3a32FXAkijEoDmEO8e/PLFFTJ4VjR9QEMt5/9vpBkNfqIBvd2pRiJ9/JDhXMgo9c nGPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=B0GwNKyxnzYc2XZeJrd2Jp5upk3uHbpBLhel/j4Yu/g=; fh=297diR+ecej0OIvRk2mjCpBt8aUOMw5BxaVdJ2A467Q=; b=C9xuB4gZhAppaVTX5l/64qdocJS56/bR073Jk0UngRj7DLWvv+3Oauj9aM+pJucaqN 8paGo1M5IJeuv89sO3GeZq1nkmpPMMsr5CcvoD3Umc+VkdxxkeTnYVRPOOnryXy4oAH7 OIg6UMnJYu6Y4xejU3fzUUgyW8NpgwF6abiK6Fj0BAx3J+xF7yluB15UT/nzgbebH0kb wc+464cA3WT0I0P/svmbfmGNmQE78kwb0aucRieq2lcA3m5tyO3f1FFDEgWL8gfoI10Z 4P65VP5Bopiw1zgAT8iL1RMzL8+6O3AYF64KJP1cyVzcJ44ingTgGVWBytWnOcYsbblq Vy7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=F6H4VZvC; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-83061-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83061-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e8-20020ac86708000000b0042e3869cb3asi7222865qtp.59.2024.02.27.02.51.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 02:51:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83061-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=F6H4VZvC; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-83061-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83061-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk 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 C31811C255E5 for ; Tue, 27 Feb 2024 10:50:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78D321386C4; Tue, 27 Feb 2024 10:50:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="F6H4VZvC" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (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 B877D1386B3; Tue, 27 Feb 2024 10:50:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709031030; cv=none; b=UroDivX9mOU2CtXG6nJneiHW97ltpuvLmPHxYZVWWzmrWnlS6IdJlK5FGgs/5zkKL16y9eU9n+Ez+YRgBal05q8oyFn5ZadLg1INPdFUe3zVR3wfPGfdx6GdUNVudFsPwQHQYNe9PRo0fNzM+a+iYNJcsG1LLjkU6huHI5cUV6M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709031030; c=relaxed/simple; bh=VwY8x8Vlvy0pr005Hz3YAUwOJLUuvB336WB7fyepl4k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Br/4bazBGuKmmPH62UmFXL/Vtc7+mnGyVx2xQVCGJV8kc+TytoI27X0xYyfXJB7eyjRjif1ePhik1W6SG3jzHS8PiG7tIv1Owe3SB6z7hOowrEKSRcPNUKteZBlO7wAhyv1xnY6xLP3XhpSXuPy6iY2Tx6dL6o3auz+/F16VxxY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=F6H4VZvC; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=B0GwNKyxnzYc2XZeJrd2Jp5upk3uHbpBLhel/j4Yu/g=; b=F6H4VZvCxh+oko+L1U7idHXzpv 5mSBTveOKOzNSpLbTrR+M7PYwoYlRjJNbNJkCyGeFxVJJMJs090VrFzcmWtj4pGL9Uv6AhSaW9mlV dzaqys+fCiPY+JqY2P9CAOUQXu5F9xCtPDEXjET14bImYYxdsYd2VLVrlDRIQV1C6+fGvJnmigDV1 mgk5RGtRBACg8tVs6lac+SzGvN5EbM3Ia4/gUJTMP1iRS5+SVCnrsFIclhgJVuRSwUp4kRSpQtNlj AmRrmwbmzATOnVzCqoDVnAdBtUIU1gDVZSz9YdYkSf5+NeVe9i6Ss3IBn4uZD9838OvLAo+098h4V 5La3mY+Q==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:36540) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rev2J-0007rZ-0M; Tue, 27 Feb 2024 10:50:11 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rev2G-0007L7-6v; Tue, 27 Feb 2024 10:50:08 +0000 Date: Tue, 27 Feb 2024 10:50:07 +0000 From: "Russell King (Oracle)" To: Maxime Chevallier Cc: Bastien Curutchet , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Pavel Machek , Lee Jones , Richard Cochran , Andrew Lunn , Heiner Kallweit , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-leds@vger.kernel.org, Thomas Petazzoni , herve.codina@bootlin.com, christophercordahi@nanometrics.ca Subject: Re: [PATCH v2 3/6] net: phy: DP83640: Add LED handling Message-ID: References: <20240227093945.21525-1-bastien.curutchet@bootlin.com> <20240227093945.21525-4-bastien.curutchet@bootlin.com> <20240227105806.7201b34a@device-28.home> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240227105806.7201b34a@device-28.home> Sender: Russell King (Oracle) On Tue, Feb 27, 2024 at 10:58:06AM +0100, Maxime Chevallier wrote: > > + val = phy_read(phydev, PHYCR) & ~(LED_CNFG_1 | LED_CNFG_0); > > + switch (mode) { > > + case DP83640_LED_MODE_1: > > + val |= LED_CNFG_0; > > + break; > > + case DP83640_LED_MODE_2: > > + /* Keeping LED_CNFG_1 and LED_CNFG_0 unset */ > > + break; > > + case DP83640_LED_MODE_3: > > + val |= LED_CNFG_1; > > + break; > > + default: > > + return -EINVAL; > > + } > > + phy_write(phydev, PHYCR, val); This should also be phy_modify() as well. Any read-modify-write sequence is open to race conditions if it is open coded because the bus lock will be dropped after the read and regained on the write. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!