Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1007180ybz; Wed, 29 Apr 2020 13:19:09 -0700 (PDT) X-Google-Smtp-Source: APiQypK7jqeHWSXcZgFEQofcQxrsAgKBWKcuHuOq3V3VdnIBG6uNM29zeXznFmlwg++AoL3R5dez X-Received: by 2002:a17:906:3004:: with SMTP id 4mr4363795ejz.381.1588191548598; Wed, 29 Apr 2020 13:19:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588191548; cv=none; d=google.com; s=arc-20160816; b=W80K6U+hjY3BScpaYjDg6OZMDemQOedIjEsjTkPHBb9yyhm4veK4WMoCFsOZErVT0+ eKibniRNYLi5np3kaVMZi6o6lgKpX8IGiy9Ri58+CFR47IFgbTks2DB9oiPG86G+sTUf ZOBh/oZmQPVu2YgCDTPz4ljPSHRX2YgvLS/Wj72ruZUYWHBteu+YRFpGMdaztniLsTm0 AgRwj4OcDbKzqIRDEhvjyDFZJv9xH6JydW4b0M4e0Ht+UzywjaK48CwJ5hwVN1geVaxN czJ8vzaybb9M4NqJlza+Sr9l6Db3ycGOQACHpoBL3qxEms+TUX0sG39FWOoBc45yvCK0 fiZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cq2CMCfNFIo7pBX1TF7b/dKJdrRkh6g3At8GmpCqDn4=; b=1G93kw9mrWcZCOQHT4NKWBk8EtH2tsWUarYrlB22wRxm0bafhUjfUU4BqzA4GuOnDM yKhz4Hy4++JLbL0ulB6VjgS7c1MA2HzXZR0qNlcKSpA8vPXN+IAiBcTPELup2AT6vd66 y2+DlTN3y6p7sTnI+qleXeWBw/ZA5RjFVr1IP4xQlUVcRANegFSDRDEkAVwPOEjdhGig xAH07uDlf29xWYjpFgQChNJg0dDzFTYXp8MsKbDfkxkl2A8m9H3GdTF2L0MnYs61+rtv WntdIVfAiBZtrXGsGxjlqNkLisDfC7iWJVF8ZfGwZ8HH1HhI+rFZ0TqM4vUhbPQw4YQq UOfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=tqN2p6cb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z15si4195834eju.349.2020.04.29.13.18.44; Wed, 29 Apr 2020 13:19:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=tqN2p6cb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727100AbgD2URS (ORCPT + 99 others); Wed, 29 Apr 2020 16:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726456AbgD2URQ (ORCPT ); Wed, 29 Apr 2020 16:17:16 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3402C03C1AE; Wed, 29 Apr 2020 13:17:15 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id x18so4129119wrq.2; Wed, 29 Apr 2020 13:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cq2CMCfNFIo7pBX1TF7b/dKJdrRkh6g3At8GmpCqDn4=; b=tqN2p6cbLg38vJgSeASbAQo1ovE3VIDD2t6o+S/8v2Lg93Hj7R1SKjQY/BzKe6J993 NeQdaiwezZodZrXhrRQUyCAblQK4cEY4lihoGyIkxM3x+XHfvlCMWfvJ4MeHjxuIV/Vk 5QLthzNaA/zn+hDa8T2iIllR1IDkd5wEjhPPu05sOHFBwtbWd5dwlGQpNBDcms5I6+cU XZJR1oo9AKQ3xWOi21Jp2EFNjMCSUotqDSq9j8kxEyDdSr/4vlN/EWuc8901AvJDobln Ho/dLv8zBDCb+Jw+HU6qBl7nbc0eg36OUpCKAUz4UdtRpxQFDO7maikXG1YkZZfRI3K/ DwCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cq2CMCfNFIo7pBX1TF7b/dKJdrRkh6g3At8GmpCqDn4=; b=SEB+oBZaVq8W+kVmJjhiYwWoByw9AsUL3GI0FpJZMY26pUaZ8IRo8Y9Wu4n/0NNHKH Rgk6EoO6VmL3M7bd2VQJ1m1+i4UkUowUJNXP6bQlCdtOG70e1NkZrxAqqrwfbMuR2jdX vls+Gm1/OvYYR2YUFgdruk46nnAMTDnvVV2YLXQp3lMIoQFOvlHR20J0C+ndIudAM9Nj CFpe8Iq8+4tebgicOxFg3+aJu7N4KBeVB8MC5Gc085W3yHG+D2LCYLEZitRLDPi3Kkxn 1r0t5ytFjLnOj16/+JS2kxFiOxlt2VR5oAxr//1mPbB29NAOAG29a3pf3gzWA0Hsvyck 7Fuw== X-Gm-Message-State: AGi0Pub3BYt1e8kb01e+GjfZlsnsbsYsXqdL3sJjwY/cOB0rJ0+Gy697 2QmRIpnVERdQ93NHrTSM9HE= X-Received: by 2002:a5d:4cd0:: with SMTP id c16mr38575871wrt.98.1588191434647; Wed, 29 Apr 2020 13:17:14 -0700 (PDT) Received: from localhost.localdomain (p200300F137142E00428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:3714:2e00:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id q143sm9923623wme.31.2020.04.29.13.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 13:17:14 -0700 (PDT) From: Martin Blumenstingl To: robh+dt@kernel.org, andrew@lunn.ch, f.fainelli@gmail.com, linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org Cc: jianxin.pan@amlogic.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Martin Blumenstingl Subject: [PATCH RFC v2 03/11] net: stmmac: dwmac-meson8b: use FIELD_PREP instead of open-coding it Date: Wed, 29 Apr 2020 22:16:36 +0200 Message-Id: <20200429201644.1144546-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200429201644.1144546-1-martin.blumenstingl@googlemail.com> References: <20200429201644.1144546-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use FIELD_PREP() to shift a value to the correct offset based on a bitmask instead of open-coding the logic. No functional changes. Signed-off-by: Martin Blumenstingl --- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c index a3934ca6a043..c9ec0cb68082 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c @@ -5,6 +5,7 @@ * Copyright (C) 2016 Martin Blumenstingl */ +#include #include #include #include @@ -32,7 +33,6 @@ #define PRG_ETH0_CLK_M250_SEL_SHIFT 4 #define PRG_ETH0_CLK_M250_SEL_MASK GENMASK(4, 4) -#define PRG_ETH0_TXDLY_SHIFT 5 #define PRG_ETH0_TXDLY_MASK GENMASK(6, 5) /* divider for the result of m250_sel */ @@ -262,7 +262,8 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) PRG_ETH0_INVERTED_RMII_CLK, 0); meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_TXDLY_MASK, - tx_dly_val << PRG_ETH0_TXDLY_SHIFT); + FIELD_PREP(PRG_ETH0_TXDLY_MASK, + tx_dly_val)); /* Configure the 125MHz RGMII TX clock, the IP block changes * the output automatically (= without us having to configure -- 2.26.2