From patchwork Sun Sep 16 20:29:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gertjan van Wingerde X-Patchwork-Id: 1463301 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A63B3DF28C for ; Sun, 16 Sep 2012 20:30:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752868Ab2IPUaz (ORCPT ); Sun, 16 Sep 2012 16:30:55 -0400 Received: from cpsmtpb-ews03.kpnxchange.com ([213.75.39.6]:2043 "EHLO cpsmtpb-ews03.kpnxchange.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752683Ab2IPU36 (ORCPT ); Sun, 16 Sep 2012 16:29:58 -0400 Received: from cpsps-ews18.kpnxchange.com ([10.94.84.184]) by cpsmtpb-ews03.kpnxchange.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 16 Sep 2012 22:29:55 +0200 Received: from CPSMTPM-CMT109.kpnxchange.com ([195.121.3.28]) by cpsps-ews18.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Sun, 16 Sep 2012 22:29:55 +0200 Received: from wingerd.gvw.nl ([86.87.118.224]) by CPSMTPM-CMT109.kpnxchange.com with Microsoft SMTPSVC(7.0.6002.18264); Sun, 16 Sep 2012 22:29:55 +0200 Received: by wingerd.gvw.nl (Postfix, from userid 1026) id 1CAD1201BFF; Sun, 16 Sep 2012 22:29:55 +0200 (CEST) From: Gertjan van Wingerde To: , "John W. Linville" Cc: , Ivo van Doorn , Helmut Schaa , Gertjan van Wingerde Subject: [PATCH 5/5] rt2x00: Clean up RFCSR1 programming in rt2800_config_channel_rf3xxx. Date: Sun, 16 Sep 2012 22:29:53 +0200 Message-Id: <1347827393-26948-6-git-send-email-gwingerde@gmail.com> X-Mailer: git-send-email 1.7.11.1 In-Reply-To: <1347827393-26948-5-git-send-email-gwingerde@gmail.com> References: <1347827393-26948-1-git-send-email-gwingerde@gmail.com> <1347827393-26948-2-git-send-email-gwingerde@gmail.com> <1347827393-26948-3-git-send-email-gwingerde@gmail.com> <1347827393-26948-4-git-send-email-gwingerde@gmail.com> <1347827393-26948-5-git-send-email-gwingerde@gmail.com> X-OriginalArrivalTime: 16 Sep 2012 20:29:55.0499 (UTC) FILETIME=[088447B0:01CD944A] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Setting of the individual fields of the RF register can be simplified. Signed-off-by: Gertjan van Wingerde Acked-by: Ivo van Doorn diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index d745c32..540c94f 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c @@ -1763,36 +1763,15 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev, rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); + rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, + rt2x00dev->default_ant.rx_chain_num <= 1); + rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, + rt2x00dev->default_ant.rx_chain_num <= 2); rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); - if (rt2x00_rt(rt2x00dev, RT3390)) { - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, - rt2x00dev->default_ant.rx_chain_num == 1); - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, - rt2x00dev->default_ant.tx_chain_num == 1); - } else { - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0); - - switch (rt2x00dev->default_ant.tx_chain_num) { - case 1: - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); - /* fall through */ - case 2: - rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1); - break; - } - - switch (rt2x00dev->default_ant.rx_chain_num) { - case 1: - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); - /* fall through */ - case 2: - rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1); - break; - } - } + rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, + rt2x00dev->default_ant.tx_chain_num <= 1); + rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, + rt2x00dev->default_ant.tx_chain_num <= 2); rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);