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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA2BCC6FA90 for ; Thu, 22 Sep 2022 07:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jA0kSmfM9GuxJOTn5JJPJgNLRQQ7LSi8OLDcSjEwcl0=; b=qC+DDw1z49MM4P utjYLMuqQk5y8PMEeQ8lpYLig9HpeZbpX+xtJflKVfeKLEhT7ouAcNkocE+6fUL4DIpWDkg5tscJ4 4jFvNOpVrdtsARSURYNm8qLhShtn2sSg3XvuRI3p6DzcxbyWJxdiB0cbYtIHqJik4u55LAv1cwjvJ hvRIAq3S+3LYKFwSBcEcY6Vw3HdpbjqRF/wJ6q/Fk1rXixBSf86fAN6ztlXzaLiyRnftznM2ZHHfw Nc4/B28agTsKaBFzwllMRn64FONGm1ujRM3Q4cgOnLWfRRRl4pSlZGHovtnp7ekxk+MuyreKQ8qqA pIAGcnbIshCkbIQWHl3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1obGSy-00DlQw-GU; Thu, 22 Sep 2022 07:17:48 +0000 Received: from madras.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e5ab]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1obGSu-00DlNa-HA; Thu, 22 Sep 2022 07:17:46 +0000 Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id E2D656601A43; Thu, 22 Sep 2022 08:17:39 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1663831060; bh=2iRz6l4AbZaBKMReNbfUfKJMN78giUanBoFMZJVDNqw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Bv12SkA6sORgmtkNyYTyDYCQVVEkaOhP+nQq2u6o+qRcpIeUPv3cJNGWvJSsJjzax uJgFU//BcUJIA68F/1qOHSu2YhZ5gpE2KpGQNZL/gRnL36qBcZNS5THXd6lPue0C6g xtnDJKzcGYBDsJG6cOG3/GvfAOjQJuO+GWPIxN/SK714s/etEUIb0Vx5lufOl1zcm9 oNeMj2sgbrjMSu82eSfucEkw6MGJ32PxEsW21okZ3gFxIB7W/ACM7b5A7kdfxEiFHP T+qGsp29lcN6b9QvN05lNchMIWt15O/955I0W+t0a/Lzvs3fF8+1L3K7O9FKMVFokX +m+N8qDZtfESQ== Message-ID: <3d8fdcf5-c2cb-be63-48d5-d84d50aeace3@collabora.com> Date: Thu, 22 Sep 2022 09:17:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH 01/18] phy: mediatek: add a new helper to update bitfield To: Chunfeng Yun , Chun-Kuang Hu , Vinod Koul Cc: Philipp Zabel , Kishon Vijay Abraham I , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Jitao Shi , Stanley Chu References: <20220920090038.15133-1-chunfeng.yun@mediatek.com> <20220920090038.15133-2-chunfeng.yun@mediatek.com> <2d13b383-7d25-240b-bdbb-e53848df4d47@collabora.com> Content-Language: en-US From: AngeloGioacchino Del Regno In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220922_001744_810425_B17DE16B X-CRM114-Status: GOOD ( 14.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Il 22/09/22 04:36, Chunfeng Yun ha scritto: > On Wed, 2022-09-21 at 10:15 +0200, AngeloGioacchino Del Regno wrote: >> Il 20/09/22 11:00, Chunfeng Yun ha scritto: >>> Due to FIELD_PREP() macro can be used to prepare a bitfield value, >>> local ones can be remove; add the new helper to make bitfield >>> update >>> easier. >>> >>> Signed-off-by: Chunfeng Yun >>> --- >>> drivers/phy/mediatek/phy-mtk-io.h | 7 +++++++ >>> 1 file changed, 7 insertions(+) >>> >>> diff --git a/drivers/phy/mediatek/phy-mtk-io.h >>> b/drivers/phy/mediatek/phy-mtk-io.h >>> index 500fcdab165d..a723d4afc9b4 100644 >>> --- a/drivers/phy/mediatek/phy-mtk-io.h >>> +++ b/drivers/phy/mediatek/phy-mtk-io.h >>> @@ -8,6 +8,7 @@ >>> #ifndef __PHY_MTK_H__ >>> #define __PHY_MTK_H__ >>> >>> +#include >>> #include >>> >>> static inline void mtk_phy_clear_bits(void __iomem *reg, u32 >>> bits) >>> @@ -35,4 +36,10 @@ static inline void mtk_phy_update_bits(void >>> __iomem *reg, u32 mask, u32 val) >>> writel(tmp, reg); >>> } >>> >>> +/* field @mask should be constant and continuous */ >> >> "Field @mask shall be [...]" >> ^^^^^ > Ok, will modify it > >> >>> +static inline void mtk_phy_update_field(void __iomem *reg, u32 >>> mask, u32 val) >> >> ...so, (void __iomem *reg, const u32 mask, u32 val) > Maybe no need const, @mask will be checked it in compile time when > use FIELD_PREP(), means @mask is a constant value, but not a variable. > Adding const is not *required*, but `mask` is, effectively, a constant, hence it fully makes sense to add const. > Thanks > >> >>> +{ >>> + mtk_phy_update_bits(reg, mask, FIELD_PREP(mask, val)); >>> +} >>> + >>> #endif >> >> > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel