Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2927069rwd; Mon, 22 May 2023 06:26:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ63dDea6pSQxLc1GafkfepYyisX2t/OVcxelQjbffJgcRvAWCSDH8nOimubShSAdbixTzXG X-Received: by 2002:a05:6a20:7d98:b0:100:607:b986 with SMTP id v24-20020a056a207d9800b001000607b986mr3639096pzj.56.1684761990885; Mon, 22 May 2023 06:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684761990; cv=none; d=google.com; s=arc-20160816; b=M1F1qMhaM0eXk7CEe3hN3qCWBcsy/A5EdqEULpC4Wg3is2ZnZywdiOd1z0VurpspxI zvAiej+PPv73Io7aSWFbmFGVNnI8JktF/BnT5xTcjblgD4rncphwYUq+FFO28oKHKuef bEaW0i8crELlshu8oUrfy5tJbNwMFNrlWZ1nE86KDz1OMosReY5Dv79iO50POrnM5mFA GaRcOzyNZo7Atnr8oaVcs0qHN2ugoKcXrhtDYFHizUnhsPaa1gvSFgUR/GL9KD/uPso2 ZzHsIyu0Bdy8k4bSrbIWxGULPWYBp1mcNWBZeavq7NvflumLLA9S01G2yqY0hfBCWe+P qc0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7fKI+TyL9epRhFvl3Z3296PLWzJTB8PM1oCdqjqMAXc=; b=0G2j7Dbq59CmS37jZUpB39V51PUYCCfUk2VwszblmhyAiImamX+n2+Qf7vrX3m5U97 zQIZxHlAMRhQ9tLbI/zLzhtx39BZ8/xWqiRLfSqaDkcgYuNSo8E9h9IKDQgCcLSfdnQ1 9NMJ6y/UJrA8Sp7kn4pYGliFVz0grLihEBbPok+oU3LwDtso6Re2kI2w0AlIZ5MorHmt HUZpzq6vZ0AxoXMsyVcPeySCZQz2kQNQ02s+rVtWAnRxBrCfR8CBH2b3ryK6eSOeimIW tk6VB3rlfVmBQwG+E/rFa8+9U+RxNacS6ZCWsJOcijGK0nAI6sMq0tja9hlrzgLp6G17 Ho4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=4iKj9bqO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a63ae0b000000b005309dcba147si4601786pgf.754.2023.05.22.06.26.17; Mon, 22 May 2023 06:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=4iKj9bqO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233484AbjEVMiF (ORCPT + 99 others); Mon, 22 May 2023 08:38:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233413AbjEVMiD (ORCPT ); Mon, 22 May 2023 08:38:03 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F30DFF1; Mon, 22 May 2023 05:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To: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=7fKI+TyL9epRhFvl3Z3296PLWzJTB8PM1oCdqjqMAXc=; b=4iKj9bqO7apDBCcsUu1X3JHG8Y vG1LbRHOFKXnXRK1qfdUKrP60ay5wQPJsJEIV+KUsgsFzAThlHT40zC0iCMgE1indGo6EjdMnhfFE dgFde4RV5VpTFtSpoHjNXSsVk9UuYs7ojdopEd5q5sThZ1HyYf5kvb1nDGhpx6W81yrE=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1q14hB-00DXcM-0J; Mon, 22 May 2023 14:31:25 +0200 Date: Mon, 22 May 2023 14:31:24 +0200 From: Andrew Lunn To: Parthiban Veerasooran Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ramon.nordin.rodriguez@ferroamp.se, horatiu.vultur@microchip.com, Woojung.Huh@microchip.com, Nicolas.Ferre@microchip.com, Thorsten.Kummermehr@microchip.com Subject: Re: [PATCH net-next v2 2/6] net: phy: microchip_t1s: replace read-modify-write code with phy_modify_mmd Message-ID: <2c78f2cc-ff5e-4dcd-a309-de21a5725053@lunn.ch> References: <20230522113331.36872-1-Parthiban.Veerasooran@microchip.com> <20230522113331.36872-3-Parthiban.Veerasooran@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230522113331.36872-3-Parthiban.Veerasooran@microchip.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > /* Read-Modified Write Pseudocode (from AN1699) > * current_val = read_register(mmd, addr) // Read current register value Hi Parthiban Maybe extend the comment to indicate that although AN1699 says Read, Modify, Write, the write is not required if the register already has the required value. That is what phy_modify_mmd() actually does. > @@ -74,12 +72,11 @@ static int lan867x_config_init(struct phy_device *phydev) > * write_register(mmd, addr, new_val) // Write back updated register value > */ > for (int i = 0; i < ARRAY_SIZE(lan867x_fixup_registers); i++) { > - reg = lan867x_fixup_registers[i]; > - reg_value = phy_read_mmd(phydev, MDIO_MMD_VEND2, reg); > - reg_value &= ~lan867x_fixup_masks[i]; > - reg_value |= lan867x_fixup_values[i]; > - err = phy_write_mmd(phydev, MDIO_MMD_VEND2, reg, reg_value); > - if (err != 0) > + err = phy_modify_mmd(phydev, MDIO_MMD_VEND2, > + lan867x_fixup_registers[i], > + lan867x_fixup_masks[i], > + lan867x_fixup_values[i]); > + if (err) > return err; > } Andrew --- pw-bot: cr