From patchwork Sun May 22 13:38:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 1978 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 5E32A3F05D for ; Sun, 22 May 2022 15:38:17 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id q12-20020a056402040c00b0042a84f9939dsf8934617edv.7 for ; Sun, 22 May 2022 06:38:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1653226697; cv=pass; d=google.com; s=arc-20160816; b=nbOxL3Na17k/sRMbiYA3ZH6PURBRZ5C3dvZFeWZ9MOotBnE4Gt7koSiZ/flOskIFNt 5J879Zge3tsjhvqs+jEyTgXjY+PgKs1H50crTgN96NyFmBI3Ku4uZdoJVNioP+jpMdQS c7XWGJzt6Qm2b4sJIt+3p7UnkEwuY0e5VAQyTQKCzORwWMJ+F6Dj26FiYcqmK6xVhoZt vNqGwJY2xRDbAaDtnz2zTXxokX9a3ZrK9bqxOw1VmpOscaN+L/aeUdFiNIyCeM9pL2IS JbYYFPPuFduENb1e2YbOhXHDhBcPCc13lQxuxLrjgwtl2QHcGrHrYC5Q4MV4sHAkMRJs xAKQ== 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=FWSZA9yxZwzIvW/D8kKJpixbDOwBJbEOVs+IL+Nzj9ttprGtKeJeuIcAYSD1pXHmkR 2EAVDF0qr0/U6eexrXmzXtXngruCnhAKzW7whJMOjLDgo81t/kksAH+0d6gBLDxnILUW AFuQp0o0otvSXzRbprmICwVS6fyg0p/kuxi8NeYHPR4OG/OM8cmJH4JGjmKhqf06412z x77W2BBLnfl+ADpDj6MuHl2h0HBPCAGykmIYMxXX09KJwKFCeTgkskBAE4OZQvVlPcsy fqVwMoWdOyiWFYyuEN5C967nvqsMZ7UihSVuVB5aVJk4YFUdplmAwJx304HSsjbam1id 7MYg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BvCCJBHQ; 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=Ch777+qk0QCUJVfPU5LZ2aWlISXu+iB5HCGoLt83+lfqaCIP+Z4be+024TsJf9EoRx DWv2KRlo1V4SIcvJAgGKp6tgV2rxLBQkEN1OnoeW4ebjXmM71j3zKCa88o33KPsKzR5Y AnW1pHfIpnlprmEdYenyAAN8X2dztezzLh204= 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=qHD26tVrtIyJEv8prvnQUgMKEyzHXflekx7WO/EbkPR48xWSGAbwru4zENaTZhisp2 5MO13d5ZMyk7hxeqT8oDOC45QqXNu2DldZV3fFGKFFlnTSolpAdFrtSPZqHthAfmlDUg OE/43Vkm+ZOyLuYFOJ73iYxyfqtEnyHHjrxZ6eJ9tv+P9CrJhA8u5KIfJcBmrb1cMJAb gRJISjXEFZYS04WFPqfJ9Zy/NwQQcHKlCVYrgiWht7QpuOt3iB7zBr5Ncop3lLntGdnS NWrrrpDteIxz3yqfN0p/XwsoCcD0A8SmYSPXcwcO5/TYf7bF1DZxpAacko8Bjn27cCrC W19g== X-Gm-Message-State: AOAM5324zzUz6P4UYQCZJvMY9NM4CKwY6nkB12LyuXtHICbhGVJs4lKr OstFU7RTMXrKUYfP9qYVVXlEyEbL X-Google-Smtp-Source: ABdhPJw4Y55NNlIQBr57ETTIZNrFJL9wtrDOue05jMX3WCnhFmN2MZP3JUQIPi+Qcj4U1w4mHBtr5g== X-Received: by 2002:a17:907:7d92:b0:6fd:bd33:f00f with SMTP id oz18-20020a1709077d9200b006fdbd33f00fmr15841041ejc.467.1653226696988; Sun, 22 May 2022 06:38:16 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2741:b0:41f:7eee:e393 with SMTP id z1-20020a056402274100b0041f7eeee393ls867799edd.3.gmail; Sun, 22 May 2022 06:38:15 -0700 (PDT) X-Received: by 2002:a05:6402:2750:b0:42b:2616:7cdb with SMTP id z16-20020a056402275000b0042b26167cdbmr13009429edd.306.1653226695593; Sun, 22 May 2022 06:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653226695; cv=none; d=google.com; s=arc-20160816; b=RhQlhYERq1UWdm8T3xlukFJUQylY9y3YWG0z9Z6bjWEwbH95XIOvXtk+JkuWoyh4A5 1uX5Y1CgOj4xVy7Alg2uXD5dBKNYaUq7Ph2cs8W33hiITfcojEc7Eumz42qZ13ltiaNi +WnJ97o7lfI2kXwT5PlqV7wr7c1LVDiPlmt+cijP8NozBastOZSNoTdTGOScBdiaRZQz OZ5tn/dbJwyZASbVxtKEkt3QFAVRGI/Qdiv0L4JZUpCh5odILQzxdLvGo2Qf4Z6OEFTi XiPjOpo6c9n/roOlxTgsiX9NLxSy5fKYrAy6UNRfsJxEwvSTuC/uDY5rNK8V8nyM5Omp umzw== 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=WuBN7t9QG+qzalS5EgfARzFhQNPpMTkYUk3bHWaEMBGaFaNqdKX6xwxr6JSNng8nM+ KaLwQxnwL3A9fojdwCJ+lFu2cHs1eZHWsN25cW0O28dtxPg2xjrPpRHxfWVTM0SAKFBh JgzC3euw5E7BUwk1HZcq+g8xuWtKxDdShzgx2Ob79MFpL0ndHE55/rDVpTf/Lav9kXZV n9LZMnVv2oVa/kOmHukMt5GaVXppdfz6S10SP4BZfJBHEZFCrmuZEoXxjBYoLRWYJuNK nRDtWa/aH84H6jYKP/ouuywwm8bYeW7LGs4l56Ayck2ZiOSJ+IUHTJ1G5dRaMyW4A0+m 3iVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BvCCJBHQ; 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 j38-20020a05640223a600b00429e2f78c66sor7080738eda.4.2022.05.22.06.38.15 for (Google Transport Security); Sun, 22 May 2022 06:38:15 -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:a05:6402:5193:b0:428:414d:e20d with SMTP id q19-20020a056402519300b00428414de20dmr19416172edd.173.1653226695286; Sun, 22 May 2022 06:38:15 -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 md17-20020a170906ae9100b006feaf472637sm2696906ejb.53.2022.05.22.06.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 06:38:14 -0700 (PDT) From: Michael Trimarchi To: Tommaso Merciai Cc: linux-amarula@amarulasolutions.com Subject: [PATCH 1/3] net: phy: DP83822: Clean up config_init code Date: Sun, 22 May 2022 15:38:11 +0200 Message-Id: <20220522133813.119729-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=BvCCJBHQ; 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; }