From patchwork Mon Dec 12 16:41:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13071255 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 852EDC4332F for ; Mon, 12 Dec 2022 16:38:50 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yq/G7SXszxEy3fFHm8fVbnoZFHWA2bcc70WIbdwcufg=; b=K69n2ZqZsOOq9A jZY4DhC5BzttuyZwVkxpGyr4w47iSwFqDXX1c0mnBYsT2bD5EkW5cVTeN+v4VeTmTZobJ4OOIjxKW JsuSNC3AbreyBEq9d9jmfLCpdOehMjSxQxpjuM/KoXRQOYnU+ZtoO/3cuiugnlOpxj5QG8Ewi6zer ADVb1VnQY86Wr0lk9IVcW9V7R+rTD99vKdK02MYfcCAOEylJV1OWE+Hvb/TMJJ/AdwG5MllHP+dCl RoQCJ4lruxjWg7M1tooi7rbu3Th6LeUyOX6e5kou65kwlfIOVTRkDWZvs4/WOQ+zI6MTN4N5ZUsYo WBWrOx05ZslFwf5a73hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p4lo7-002AyL-I3; Mon, 12 Dec 2022 16:37:35 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p4lnN-002AHR-Dp for linux-arm-kernel@lists.infradead.org; Mon, 12 Dec 2022 16:36:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670863009; x=1702399009; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5xjzRZVtRE1cVlsbZZS0eIcjhBI2JgzIzQmwqEVYM3I=; b=VjQ7N+d1J6uw3xelGMdr197ND27nlOBJFL0zdkf+C6NXvJ4/jIIF/al7 Kd9EWkh8lI+pymEB1+xCEtrW57O5AN3vmRGDxt3G60XI6d1i9I/vDDdsl kWVWPAa0xk/tqWXuw0EFM7d3RVrDnReCl67E4aJSoAEsrzkslcbzZWlFk XiEeZ7W/ralFXxlcQOzmqS03tZmaTO1Ycn8sZnsEjwexnM5Wu7wOOcY7w lLdq6ex27RAs46COfVKdC5QkMSOnj5Ap/6tpEbEUHe/rJD8DXH0vc0BDu /1h+MHK+x38016cE2zyuaoZaXja+zNQDtgMxg9OK+R4xq/sfu4jPWzSj2 Q==; X-IronPort-AV: E=Sophos;i="5.96,238,1665471600"; d="scan'208";a="192721522" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 12 Dec 2022 09:36:47 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 12 Dec 2022 09:36:46 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 12 Dec 2022 09:36:43 -0700 From: Claudiu Beznea To: , , , , , , , CC: , , , , Claudiu Beznea Subject: [PATCH v2 4/4] ASoC: mchp-spdiftx: use FIELD_PREP() where possible Date: Mon, 12 Dec 2022 18:41:53 +0200 Message-ID: <20221212164153.78677-5-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20221212164153.78677-1-claudiu.beznea@microchip.com> References: <20221212164153.78677-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221212_083649_512845_1EC3802E X-CRM114-Status: UNSURE ( 8.30 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use FIELD_PREP() in macro definitions. Signed-off-by: Claudiu Beznea --- sound/soc/atmel/mchp-spdiftx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/atmel/mchp-spdiftx.c b/sound/soc/atmel/mchp-spdiftx.c index dc96a6fbf514..20d135c718b0 100644 --- a/sound/soc/atmel/mchp-spdiftx.c +++ b/sound/soc/atmel/mchp-spdiftx.c @@ -6,6 +6,7 @@ // // Author: Codrin Ciubotariu +#include #include #include #include @@ -71,11 +72,11 @@ /* Valid Bits per Sample */ #define SPDIFTX_MR_VBPS_MASK GENMASK(13, 8) -#define SPDIFTX_MR_VBPS(bps) (((bps) << 8) & SPDIFTX_MR_VBPS_MASK) +#define SPDIFTX_MR_VBPS(bps) FIELD_PREP(SPDIFTX_MR_VBPS_MASK, bps) /* Chunk Size */ #define SPDIFTX_MR_CHUNK_MASK GENMASK(19, 16) -#define SPDIFTX_MR_CHUNK(size) (((size) << 16) & SPDIFTX_MR_CHUNK_MASK) +#define SPDIFTX_MR_CHUNK(size) FIELD_PREP(SPDIFTX_MR_CHUNK_MASK, size) /* Validity Bits for Channels 1 and 2 */ #define SPDIFTX_MR_VALID1 BIT(24) @@ -88,8 +89,7 @@ /* Bytes per Sample */ #define SPDIFTX_MR_BPS_MASK GENMASK(29, 28) -#define SPDIFTX_MR_BPS(bytes) \ - ((((bytes) - 1) << 28) & SPDIFTX_MR_BPS_MASK) +#define SPDIFTX_MR_BPS(bytes) FIELD_PREP(SPDIFTX_MR_BPS_MASK, (bytes - 1)) /* * ---- Interrupt Enable/Disable/Mask/Status Register (Write/Read-only) ----