Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3015529ybl; Sun, 15 Dec 2019 00:56:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxvyaqFUPALxs/+U//rVjxEpAuc08OO6bV1J8FZJjkrh0Y6CGA+J+aqDq6GNjdXHMDjtVGt X-Received: by 2002:a05:6830:2046:: with SMTP id f6mr26272534otp.206.1576400217609; Sun, 15 Dec 2019 00:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576400217; cv=none; d=google.com; s=arc-20160816; b=s1hyElUZYHTaHy43OJ4hQBheNmqOueeWhBnGZrbrvoWQuBq6t5DrVzX+iQ732smz9u xatofgpI6sNWQHhC6Q23xxkGSChelYTezdrt94qqj07pFIy044PlPRAznTCZCpDYd5Vp G/0jW4AJD6WG9WQnSCISXXcBkcM61aW6rN8oK7cAvAsD6phvsAnu3faniz0YuXvu+V4F 5oKXaswwWPY1NJ6JLvt1GLcQEQ8xR6Xv5l4s5Iq49BXggRe/jk/JDyFxL3VTgmirAxCQ YcX36iNCE6LfLbeFHHJcrtyU1cKqNoK7/E5X5vu7iK9M+ZJVbVl3xzFq0ps56W1R61OL tOJQ== 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=D+/HILDexw6oLxasfpS8hqUPCseVtOafgTTbwLBWx2o=; b=D82VIcG92TP6BgbulRnyKV2NFcQdBN5jAFRUl1PNhUsxksgg0nEgyWeAfwJjpw3iOR 7xZ9qn8WLNcnc4jhehIG8LDGxBfaeVDpSRZ6mzXdK8bzIiL12AegKGRB63lsvWoVKqNI Yav22mGiLEI1HEgKsT+yCxTEiJ4Lj3yP6rUmiuaaRdKYFtilX9sGqZWDMx3nOe12IVc8 erZjRHLqEENQgbegcoaWOj56AEBD01UBa0P+NY5Qzb5RP521UjOkCOrGJszDAn/Ve9U7 dxCqbt1/T6OEJSWCotBVmeIpWzhaiyv5JQTuAmvJqR5xq+7/suKM6pxysZWCWhp4FciS Asug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kdqZ+y15; 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 x68si8973303oia.227.2019.12.15.00.56.47; Sun, 15 Dec 2019 00:56:57 -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=kdqZ+y15; 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 S1726089AbfLOIyc (ORCPT + 99 others); Sun, 15 Dec 2019 03:54:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:40906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfLOIyc (ORCPT ); Sun, 15 Dec 2019 03:54:32 -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 30D2020700; Sun, 15 Dec 2019 08:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576400072; bh=B2uFL7eacM94GN6CzJ6hHY8Y5gBE1zCmo2r5rzAF3DI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kdqZ+y15KIyr9KpRrmZLZgEMUEa7Bv/zale6oLhZhruQIDFikQ42eUIiaJfm1D1FQ N0CCFXPC0mXJjPaXrn/U6FBLRypE4OCIcG9D2fO6vuc3haS98ifb0hOUGeNSX5U9Uv SI2/iK3DKfmuMILgSK7UTXKFZ6Hv5XBPb6Uhknys= From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com Subject: [PATCH 2/2] mt76: mt7603: simplify led reg definitions Date: Sun, 15 Dec 2019 09:54:10 +0100 Message-Id: <263c57c29b774556bb11035882f8c0bc8ccdc77f.1576399834.git.lorenzo@kernel.org> 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/mt7603/regs.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/regs.h b/drivers/net/wireless/mediatek/mt76/mt7603/regs.h index 6e23ed3dfdff..52425eb187f6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/regs.h +++ b/drivers/net/wireless/mediatek/mt76/mt7603/regs.h @@ -586,17 +586,11 @@ enum { #define MT_LED_STATUS_0(_n) MT_LED_PHYS(0x10 + ((_n) * 8)) #define MT_LED_STATUS_1(_n) MT_LED_PHYS(0x14 + ((_n) * 8)) #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, 0) -#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_CLIENT_BASE_PHYS_ADDR 0x800c0000 -- 2.21.0