From patchwork Mon Oct 27 00:05:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Mcquade X-Patchwork-Id: 5155721 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 737579F318 for ; Mon, 27 Oct 2014 00:05:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 66C0D20272 for ; Mon, 27 Oct 2014 00:05:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3916820270 for ; Mon, 27 Oct 2014 00:05:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751862AbaJ0AFH (ORCPT ); Sun, 26 Oct 2014 20:05:07 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:58141 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751645AbaJ0AFG (ORCPT ); Sun, 26 Oct 2014 20:05:06 -0400 Received: by mail-wi0-f182.google.com with SMTP id d1so1468837wiv.15 for ; Sun, 26 Oct 2014 17:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=cwD2rWCY+TsyvRvwOIBpsiqOmdqAbCoXSdH/hyiv7Gc=; b=u2bWljVyokTaq6i1S5JOSTCUHmklZmakDF65Wx84xgqJUmfkp5kDObK2aWzb6shBE4 QFLNx3bevmuKH20FD+ew044okMQgYBXIjkLI5Sb+QNH4bH1N6f7aACGFbvrMN3RXeW0q rMC1UisQED2kuMa55sxq3vp0+FDpr8MpDa+RDTUUey+5ro2TAkcsHTtUTZiyas3IKrId gfoLgXchngSn8rNwyl0/HuL1MQGlxSTVA6LQHebuyNSiQzgMMCKlVWrSygdFbJ8xIbhB R+Moyxwejjh7c9qiN3BUPmOty4aVoDRLcIgyItJ/9SnbpJ+nKqP6Oy94QeXMuTeJiQgv LqyQ== X-Received: by 10.180.73.212 with SMTP id n20mr17056848wiv.59.1414368304455; Sun, 26 Oct 2014 17:05:04 -0700 (PDT) Received: from paul87-SATELLITE-L850D-12P.Home ([78.18.70.101]) by mx.google.com with ESMTPSA id bv17sm9988940wib.13.2014.10.26.17.05.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 26 Oct 2014 17:05:03 -0700 (PDT) From: Paul McQuade To: paulmcquad@gmail.com Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org, gregkh@linuxfoundation.org, Jes.Sorensen@redhat.com, Larry.Finger@lwfinger.net Subject: [PATCH] staging: rtl8723au: create macro get_max_rate Date: Mon, 27 Oct 2014 00:05:00 +0000 Message-Id: <1414368300-9596-1-git-send-email-paulmcquad@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP create marco for max_rate values Signed-off-by: Paul McQuade --- drivers/staging/rtl8723au/core/rtw_ieee80211.c | 58 ++++++++++++-------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c b/drivers/staging/rtl8723au/core/rtw_ieee80211.c index 6274cb3..4c0414d 100644 --- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c @@ -13,6 +13,8 @@ * ******************************************************************************/ #define _IEEE80211_C +#define get_max_rate(r1, r2, r3, r4) \ + (bw_40MHz ? (short_GI_40 ? r1 : r2) : (short_GI_20 ? r3 : r4)) #include #include @@ -794,64 +796,56 @@ u16 rtw_mcs_rate23a(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40, if (rf_type == RF_1T1R) { if (mcs->rx_mask[0] & BIT(7)) - max_rate = (bw_40MHz) ? ((short_GI_40)?1500:1350): - ((short_GI_20)?722:650); + max_rate = get_max_rate(1500, 1350, 722, 650); else if (mcs->rx_mask[0] & BIT(6)) - max_rate = (bw_40MHz) ? ((short_GI_40)?1350:1215): - ((short_GI_20)?650:585); + max_rate = get_max_rate(1350, 1215, 650, 585); else if (mcs->rx_mask[0] & BIT(5)) - max_rate = (bw_40MHz) ? ((short_GI_40)?1200:1080): - ((short_GI_20)?578:520); + max_rate = get_max_rate(1200, 1080, 578, 520); else if (mcs->rx_mask[0] & BIT(4)) - max_rate = (bw_40MHz) ? ((short_GI_40)?900:810): - ((short_GI_20)?433:390); + max_rate = get_max_rate(900, 810, 433, 390); else if (mcs->rx_mask[0] & BIT(3)) - max_rate = (bw_40MHz) ? ((short_GI_40)?600:540): - ((short_GI_20)?289:260); + max_rate = get_max_rate(600, 540, 289, 260); else if (mcs->rx_mask[0] & BIT(2)) - max_rate = (bw_40MHz) ? ((short_GI_40)?450:405): - ((short_GI_20)?217:195); + max_rate = get_max_rate(450, 405, 217, 195); else if (mcs->rx_mask[0] & BIT(1)) - max_rate = (bw_40MHz) ? ((short_GI_40)?300:270): - ((short_GI_20)?144:130); + max_rate = get_max_rate(300, 270, 144, 130); else if (mcs->rx_mask[0] & BIT(0)) - max_rate = (bw_40MHz) ? ((short_GI_40)?150:135): - ((short_GI_20)?72:65); + max_rate = get_max_rate(150, 135, 72, 65); } else { if (mcs->rx_mask[1]) { if (mcs->rx_mask[1] & BIT(7)) - max_rate = (bw_40MHz) ? ((short_GI_40)?3000:2700):((short_GI_20)?1444:1300); + max_rate = get_max_rate(3000, 2700, 1444, 1300); else if (mcs->rx_mask[1] & BIT(6)) - max_rate = (bw_40MHz) ? ((short_GI_40)?2700:2430):((short_GI_20)?1300:1170); + max_rate = get_max_rate(2700, 2430, 1300, 1170); else if (mcs->rx_mask[1] & BIT(5)) - max_rate = (bw_40MHz) ? ((short_GI_40)?2400:2160):((short_GI_20)?1156:1040); + max_rate = get_max_rate(2400, 2160, 1156, 1040); else if (mcs->rx_mask[1] & BIT(4)) - max_rate = (bw_40MHz) ? ((short_GI_40)?1800:1620):((short_GI_20)?867:780); + max_rate = get_max_rate(1800, 1620, 867, 780); else if (mcs->rx_mask[1] & BIT(3)) - max_rate = (bw_40MHz) ? ((short_GI_40)?1200:1080):((short_GI_20)?578:520); + max_rate = get_max_rate(1200, 1080, 578, 520); else if (mcs->rx_mask[1] & BIT(2)) - max_rate = (bw_40MHz) ? ((short_GI_40)?900:810):((short_GI_20)?433:390); + max_rate = get_max_rate(900, 810, 433, 390); else if (mcs->rx_mask[1] & BIT(1)) - max_rate = (bw_40MHz) ? ((short_GI_40)?600:540):((short_GI_20)?289:260); + max_rate = get_max_rate(600, 540, 289, 260); else if (mcs->rx_mask[1] & BIT(0)) - max_rate = (bw_40MHz) ? ((short_GI_40)?300:270):((short_GI_20)?144:130); + max_rate = get_max_rate(300, 270, 144, 130); } else { if (mcs->rx_mask[0] & BIT(7)) - max_rate = (bw_40MHz) ? ((short_GI_40)?1500:1350):((short_GI_20)?722:650); + max_rate = get_max_rate(1500, 1350, 722, 650); else if (mcs->rx_mask[0] & BIT(6)) - max_rate = (bw_40MHz) ? ((short_GI_40)?1350:1215):((short_GI_20)?650:585); + max_rate = get_max_rate(1350, 1215, 650, 585); else if (mcs->rx_mask[0] & BIT(5)) - max_rate = (bw_40MHz) ? ((short_GI_40)?1200:1080):((short_GI_20)?578:520); + max_rate = get_max_rate(1200, 1080, 578, 520); else if (mcs->rx_mask[0] & BIT(4)) - max_rate = (bw_40MHz) ? ((short_GI_40)?900:810):((short_GI_20)?433:390); + max_rate = get_max_rate(900, 810, 433, 390); else if (mcs->rx_mask[0] & BIT(3)) - max_rate = (bw_40MHz) ? ((short_GI_40)?600:540):((short_GI_20)?289:260); + max_rate = get_max_rate(600, 540, 289, 260); else if (mcs->rx_mask[0] & BIT(2)) - max_rate = (bw_40MHz) ? ((short_GI_40)?450:405):((short_GI_20)?217:195); + max_rate = get_max_rate(450, 405, 217, 195); else if (mcs->rx_mask[0] & BIT(1)) - max_rate = (bw_40MHz) ? ((short_GI_40)?300:270):((short_GI_20)?144:130); + max_rate = get_max_rate(300, 270, 144, 130); else if (mcs->rx_mask[0] & BIT(0)) - max_rate = (bw_40MHz) ? ((short_GI_40)?150:135):((short_GI_20)?72:65); + max_rate = get_max_rate(150, 135, 72, 65); } } return max_rate;