Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3015193ybl; Sun, 15 Dec 2019 00:56:26 -0800 (PST) X-Google-Smtp-Source: APXvYqw8N4rlHG1g0UE4VyQfqVRlmgfi8J1SAajQS14uIn5m5PNlsRdmwDdhExGnwRNsk+5DtUWM X-Received: by 2002:a9d:6a8f:: with SMTP id l15mr24601638otq.59.1576400186445; Sun, 15 Dec 2019 00:56:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576400186; cv=none; d=google.com; s=arc-20160816; b=XWt4+YtdJkEyyhtlXNOMUOExowQ9ZXQupeuyUemthjc21mw+cmN/x2U6EOQr3b2sck ox1nQCH2eIYldozwDGaOtvgZPbm/AIiASv3ShQxxxBy7UzojDu7wN++YyRNiwm/xPqaK lQFu2J8OHEqGrBG3G5uO0A21RkJ2lc7ebRerYUdvUM9X487dBHy4fbzNC4WGmUYBfl53 iWzBmhx2Hd1GUF5tdSx8LqCfcXfUJOQjcOivb57EiNzyprUNa2dLYrJ18S0EsUGg+lx9 td3xpNT35g6i33ufnlWGINGRT+6hbc06pqzOyKRfm5FAzzxHRkhP0wpcV1Z2MyiqBN4R AvhQ== 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=cC5yrnm0P8otrvi1rNY+MuutXaRLI60kgbdzjR3kE1A=; b=CaITWcQ2EPl8uQeUPe4dAoDsgaAzR+Bg8iWo0UXUsr3fS6OdYUYzQXeUvieUWllS8y GnpvNXuiRYa4aajUXnqCFBaMza/Yhu/9J/Zc6UPpEsZt1Vz11S8Ibta+XL7wQZoqi75v l0/p00yjIVxI2YIXqc2R7AqMwbX8t3fXdT94nlLLpAovDjPlgd87JdScgbHerDmuQGvk 02+CAQnvco0mbYtRiiPGg5/acmamfsKXetrEQNrkYpaPLOvGQf+V6JsAdQCoDn0jZb/8 f746nuw7HH3vEIfHEsl/8QGqDaA9tbsP7CFSKeruoAGOSAL/v8RgjHLfyOxSZqV89l+z ktZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BtRefwSH; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y198si8945774oia.163.2019.12.15.00.56.15; Sun, 15 Dec 2019 00:56:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BtRefwSH; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726078AbfLOIy1 (ORCPT + 99 others); Sun, 15 Dec 2019 03:54:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:40898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfLOIy1 (ORCPT ); Sun, 15 Dec 2019 03:54:27 -0500 Received: from localhost.localdomain (unknown [151.66.51.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B418B2253D; Sun, 15 Dec 2019 08:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576400066; bh=m8382Slgk6TtPR/BB10SFu4b7IjvbGGfX7nDIiURr4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BtRefwSHlka83fGkz34ExiZwdCkqSdCcPV8FFTiRQsJnxipTkkLkCHpHPQZWT7tcZ 0xGamwS3xh+qznqGesh6Sx6NgRLhvgp2pWX6CObyFsJ8OG6mre6TDYWzG6ZDZjEQUt 1nI6QUjO0KDaJ6pswiD14qrf8S8DuvMhq82K6nts= From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com Subject: [PATCH 1/2] mt76: mt76x02: simplify led reg definitions Date: Sun, 15 Dec 2019 09:54:09 +0100 Message-Id: X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Rely on FIELD_PREP macro for led register definitions and remove open coding Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x02_regs.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h b/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h index 21c0f351fa09..b69a495d0b9a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h @@ -236,14 +236,11 @@ #define MT_LED_S1_BASE 0x0780 #define MT_LED_S1(_n) (MT_LED_S1_BASE + 8 * (_n)) #define MT_LED_STATUS_OFF_MASK GENMASK(31, 24) -#define MT_LED_STATUS_OFF(_v) (((_v) << __ffs(MT_LED_STATUS_OFF_MASK)) & \ - MT_LED_STATUS_OFF_MASK) +#define MT_LED_STATUS_OFF(_v) FIELD_PREP(MT_LED_STATUS_OFF_MASK, (_v)) #define MT_LED_STATUS_ON_MASK GENMASK(23, 16) -#define MT_LED_STATUS_ON(_v) (((_v) << __ffs(MT_LED_STATUS_ON_MASK)) & \ - MT_LED_STATUS_ON_MASK) +#define MT_LED_STATUS_ON(_v) FIELD_PREP(MT_LED_STATUS_ON_MASK, (_v)) #define MT_LED_STATUS_DURATION_MASK GENMASK(15, 8) -#define MT_LED_STATUS_DURATION(_v) (((_v) << __ffs(MT_LED_STATUS_DURATION_MASK)) & \ - MT_LED_STATUS_DURATION_MASK) +#define MT_LED_STATUS_DURATION(_v) FIELD_PREP(MT_LED_STATUS_DURATION_MASK, (_v)) #define MT_FCE_PSE_CTRL 0x0800 #define MT_FCE_PARAMETERS 0x0804 -- 2.21.0