From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59E1EC77B73 for ; Mon, 22 May 2023 12:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231487AbjEVMiG (ORCPT ); Mon, 22 May 2023 08:38:06 -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> 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