From patchwork Tue Jan 4 23:48:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jussi Kivilinna X-Patchwork-Id: 452141 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p04NmHQV015758 for ; Tue, 4 Jan 2011 23:48:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751395Ab1ADXsQ (ORCPT ); Tue, 4 Jan 2011 18:48:16 -0500 Received: from sypressi.dnainternet.net ([83.102.40.135]:55413 "EHLO sypressi.dnainternet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751055Ab1ADXsQ (ORCPT ); Tue, 4 Jan 2011 18:48:16 -0500 Received: from localhost (localhost [127.0.0.1]) by sypressi.dnainternet.net (Postfix) with ESMTP id F3E5AC6A39; Wed, 5 Jan 2011 01:48:14 +0200 (EET) X-Virus-Scanned: DNA Postiturva at dnainternet.net X-Spam-Flag: NO X-Spam-Score: -1.44 X-Spam-Level: X-Spam-Status: No, score=-1.44 tagged_above=-9999 required=6 tests=[ALL_TRUSTED=-1.44] Received: from sypressi.dnainternet.net ([83.102.40.135]) by localhost (sypressi.dnainternet.net [127.0.0.1]) (amavisd-new, port 10041) with ESMTP id HA++5ZQQS1e7; Wed, 5 Jan 2011 01:48:14 +0200 (EET) Received: from omenapuu.dnainternet.net (omenapuu.dnainternet.net [83.102.40.212]) by sypressi.dnainternet.net (Postfix) with ESMTP id C5FD2C66A1; Wed, 5 Jan 2011 01:48:14 +0200 (EET) Received: from fate.lan (dyn2-85-23-163-107.psoas.suomi.net [85.23.163.107]) by omenapuu.dnainternet.net (Postfix) with ESMTP id 901682BAD5; Wed, 5 Jan 2011 01:48:11 +0200 (EET) Subject: [RFC PATCH 03/17] zd1211rw: fix beacon interval setup To: linux-wireless@vger.kernel.org From: Jussi Kivilinna Cc: Daniel Drake , Ulrich Kunitz Date: Wed, 05 Jan 2011 01:48:11 +0200 Message-ID: <20110104234811.25309.34778.stgit@fate.lan> In-Reply-To: <20110104234745.25309.72030.stgit@fate.lan> References: <20110104234745.25309.72030.stgit@fate.lan> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 04 Jan 2011 23:48:17 +0000 (UTC) diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c index 6effe18..8c05737 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ b/drivers/net/wireless/zd1211rw/zd_chip.c @@ -848,11 +848,12 @@ static int get_aw_pt_bi(struct zd_chip *chip, struct aw_pt_bi *s) static int set_aw_pt_bi(struct zd_chip *chip, struct aw_pt_bi *s) { struct zd_ioreq32 reqs[3]; + u16 b_interval = s->beacon_interval & 0xffff; - if (s->beacon_interval <= 5) - s->beacon_interval = 5; - if (s->pre_tbtt < 4 || s->pre_tbtt >= s->beacon_interval) - s->pre_tbtt = s->beacon_interval - 1; + if (b_interval <= 5) + b_interval = 5; + if (s->pre_tbtt < 4 || s->pre_tbtt >= b_interval) + s->pre_tbtt = b_interval - 1; if (s->atim_wnd_period >= s->pre_tbtt) s->atim_wnd_period = s->pre_tbtt - 1; @@ -861,7 +862,7 @@ static int set_aw_pt_bi(struct zd_chip *chip, struct aw_pt_bi *s) reqs[1].addr = CR_PRE_TBTT; reqs[1].value = s->pre_tbtt; reqs[2].addr = CR_BCN_INTERVAL; - reqs[2].value = s->beacon_interval; + reqs[2].value = (s->beacon_interval & ~0xffff) | b_interval; return zd_iowrite32a_locked(chip, reqs, ARRAY_SIZE(reqs)); } @@ -873,10 +874,13 @@ static int set_beacon_interval(struct zd_chip *chip, u32 interval) struct aw_pt_bi s; ZD_ASSERT(mutex_is_locked(&chip->mutex)); + + r = zd_iowrite32_locked(chip, interval, CR_BCN_INTERVAL); + if (r) + return r; r = get_aw_pt_bi(chip, &s); if (r) return r; - s.beacon_interval = interval; return set_aw_pt_bi(chip, &s); }