From patchwork Sun May 22 13:41:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 1981 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id CEB683F05D for ; Sun, 22 May 2022 15:41:49 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id w5-20020a056402128500b0042aa2647eb6sf8942786edv.12 for ; Sun, 22 May 2022 06:41:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1653226909; cv=pass; d=google.com; s=arc-20160816; b=rXgIn+/tW/lBLx6NneY4U2yjOK1758yesa8iUVcHfKUd303lok98ggoLUGP0OAyEn/ Y+izoVIcG+BtE3CNfIj4shmmWQLQ7oSukgOkoyDuOIfP7Op2ecD59dVhvS2kC63cVLEJ uk6KSA4buTn4Ubz9skfLzxzc5KD/NGEtmhV/gScPELUHG4MXtRCHaPXWMjr8UHG6HSFQ 3nN19QmWtsLdS5hnlPhm2qB/Mo2IkjIxVGd629K2CE9BkWws0paIQmt8JJ08T/eT+ATf v87CfiOx4pZvo7wFk381KSpYLSDCI7pmhLPuCzrrGmU2kXdgPfH83Q9Q8S+1BDmv51KC Isdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=1XNvf+1fKMVQbUUaydO3aKIe1Po6v4alzNFPb2SimIQ=; b=hpvX5i9e+YNBC/MH1+Iz349Yi7ArNcrMpr7TeGBX1Vry1JNIpB9mvBqXgA5vrSiLUj mi7syIqBQ/6UAWuEntnf3Eb3FC7ITbDbUjEkUjr83CPzYbEDEWMJdrtmBYjBSELwK0lM 2DDXdfY+H/T/4Yqb5e44Hr8voPGrVvWF6NKy6NpLe89kxEMPR0h3jlh2uAKRHolsrbjg hLtygw5JHjqdvlrPw15QZaMZSNnwdU/QX1XeFoC0tciaeb4GD/pgmHa63NyM6qUCNOrH J+ImYTbvBFVWsssfWbWAq6QP11WZLpWh+s6DPSMRlAnHHnqtNkrpeXCm4ZlVX/PGPldA /M7A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GryjDlxH; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=1XNvf+1fKMVQbUUaydO3aKIe1Po6v4alzNFPb2SimIQ=; b=aifzHIcBzrr/OuutvGMCMlO9Jo0JwZROeRmYs2x+Azf2jScFlPl6piZiI151Ifw9DB JYkycnO9q4zBTG2MbrWEh0sbMHO4lBENEPkUeaTjYw5u/8YwTOSC6Ki3IOXjRbQXiThC nrZVKRU8luILVCKKOLHpiK800Ii2uo+on5vlI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=1XNvf+1fKMVQbUUaydO3aKIe1Po6v4alzNFPb2SimIQ=; b=wPMRTwpJBFXBaBEGNdU5VNUBSY3qQZqtydShJ8bZsHvIzdOepLqJChEgcxsMtLhfLS mm5XkPphz9St/Pwg84ekMe/Z0ZX41VQ7yo43+8l8373WZ70acphM4BEvkzz1/CIwLcUQ qnKPo20YXmATWknHGmoYjnKem6v4T0dghdoy3fWtC6Lb0kBWyOl/IiqJ6lQvlAJuvMw5 qnT5FKAYwVMwY4jQvKVq5+TbM7owl5C5HdCsjN1iJcai0B5NWT7V2Z9oB8AW60xr6ZFb mvWEQ3z3ecnwjhdlKssT6/EmUHf0vVQRtrk6+Cs8RnJTYiWa5pwTF5ZP+lQWjBgQC4rH WUiw== X-Gm-Message-State: AOAM5323m9o1ao9ctT6z3pYNK4Biudyc1kBL3lzUv52X7sKWQsZn5DGl NNtLnwzeEb0yDX7WWMHOEyzWgX0k X-Google-Smtp-Source: ABdhPJxc4h4A0Jxbc2jmFIKX1sRCaYsbKNdykRkPxR1TsSRGzGij284fTi+yJ1AToUuV7JJxcVGQSg== X-Received: by 2002:aa7:c595:0:b0:42a:b571:2726 with SMTP id g21-20020aa7c595000000b0042ab5712726mr19981626edq.48.1653226909613; Sun, 22 May 2022 06:41:49 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:9910:b0:6fe:c0cb:366b with SMTP id zl16-20020a170906991000b006fec0cb366bls1058621ejb.11.gmail; Sun, 22 May 2022 06:41:48 -0700 (PDT) X-Received: by 2002:a17:907:7baa:b0:6fe:b3dc:2378 with SMTP id ne42-20020a1709077baa00b006feb3dc2378mr9025349ejc.266.1653226908179; Sun, 22 May 2022 06:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653226908; cv=none; d=google.com; s=arc-20160816; b=wle9rTSknqW1OJYEXfc9QV1PTFnFXyDf/0BoJgUtxhjOLqGNE7UKxwkic3HHQY0tZG bwRAU8kUj+CLEa24LabMROQxt3wqC/1OwWmDjKsRB1qhUPZ8+LmTiUtYwSDYXMX6xj90 vNmFQEp7OkMk2vYDAF0Js4lQMnTOFGhnDayrrTZDWeHXjegP9+dJzd/mqPpyAcikW56L kf+t/aUYabhxun6xTaJ8A6tOvjIith3Q5DoeHkD3AzII9ZSOOPu7OzRPPgO/NGYOPgAi A2rkmWVsqEG8JRXhOPMaZSmU62GgUliqyZYbNB7vCCr8dlirrErH2Om2OB4RD7kghS+T VzYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=Dqmu0Iahg3CS/5jd7u9PaALU1v41yhVtsfvP9I5+8DY=; b=NM0PHebwwWxtNzCU+G+f3MrcygQdKbP7eQ9DtxiRUul+PM/N5RNtPjsFbyLTenWmza VHluoaLsNBOlqhpjawtCF/euRKlIDLzEkJfmNfcOnno3QVpwzwtrraf9UmnJw+1ib6sJ VmuNl6yLqe92ElavaUfopYiEZvjZm+Ddnp2Y9KdF9/wU2v3rxLDiasM+d+BN0H5drwKZ 29nPfaw68Hw5W2dagCdZT90G/uxb7OMkGFReY+J3MgVq7CJI4+TxLNn85IZFzVqqKhI9 eGmCKogNiAwYXWyOGOvpuZkAdGE/DzBxVMoMYOSejbsYKHYE7rUqPHfxh88LopqtBcVC M5/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GryjDlxH; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id jv21-20020a170907769500b006febde6d776sor1156409ejc.30.2022.05.22.06.41.48 for (Google Transport Security); Sun, 22 May 2022 06:41:48 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:906:c149:b0:6f9:2a43:ef37 with SMTP id dp9-20020a170906c14900b006f92a43ef37mr16008816ejc.17.1653226907887; Sun, 22 May 2022 06:41:47 -0700 (PDT) Received: from panicking.amarulasolutions.com (host-80-21-24-253.business.telecomitalia.it. [80.21.24.253]) by smtp.gmail.com with ESMTPSA id h22-20020aa7cdd6000000b0042abb914d6asm6772383edw.69.2022.05.22.06.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 06:41:47 -0700 (PDT) From: Michael Trimarchi To: Tommaso Merciai Cc: linux-amarula@amarulasolutions.com Subject: [PATCH V2 1/3] net: phy: DP83822: Clean up config_init code Date: Sun, 22 May 2022 15:41:44 +0200 Message-Id: <20220522134146.120312-1-michael@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GryjDlxH; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Rename some variables and reduce a bit code complexity. No functional changes Signed-off-by: Michael Trimarchi --- drivers/net/phy/dp83822.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c index ce17b2af3218..c344b8ffaf3c 100644 --- a/drivers/net/phy/dp83822.c +++ b/drivers/net/phy/dp83822.c @@ -380,31 +380,26 @@ static int dp83822_config_init(struct phy_device *phydev) { struct dp83822_private *dp83822 = phydev->priv; struct device *dev = &phydev->mdio.dev; - int rgmii_delay; - s32 rx_int_delay; - s32 tx_int_delay; + int value = 0; + s32 trx_int_delay; int err = 0; int bmcr; if (phy_interface_is_rgmii(phydev)) { - rx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0, + trx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0, true); - if (rx_int_delay <= 0) - rgmii_delay = 0; - else - rgmii_delay = DP83822_RX_CLK_SHIFT; + if (trx_int_delay > 0) + value = DP83822_RX_CLK_SHIFT; - tx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0, + trx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0, false); - if (tx_int_delay <= 0) - rgmii_delay &= ~DP83822_TX_CLK_SHIFT; - else - rgmii_delay |= DP83822_TX_CLK_SHIFT; + if (trx_int_delay > 0) + value |= DP83822_TX_CLK_SHIFT; - if (rgmii_delay) { + if (value) { err = phy_set_bits_mmd(phydev, DP83822_DEVADDR, - MII_DP83822_RCSR, rgmii_delay); + MII_DP83822_RCSR, value); if (err) return err; }