From patchwork Tue Nov 23 18:52:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Kossifidis X-Patchwork-Id: 350241 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 oANIwFUg004920 for ; Tue, 23 Nov 2010 19:00:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754588Ab0KWSws (ORCPT ); Tue, 23 Nov 2010 13:52:48 -0500 Received: from mail-ey0-f174.google.com ([209.85.215.174]:45591 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754235Ab0KWSws (ORCPT ); Tue, 23 Nov 2010 13:52:48 -0500 Received: by eye27 with SMTP id 27so4869103eye.19 for ; Tue, 23 Nov 2010 10:52:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mail-followup-to:mime-version:content-type :content-disposition:user-agent; bh=jWKaf3fq4239wvGDMIacSEvGakfTrrkusBN8/VEedGA=; b=OAUom5QQ1w7wrKy6dtcQ271ds/cjbA8FpnnqbwjPATfgwNspfoQWbzdm/xTjpL8bLR QVcfczl+p+J65dQTWy5T87jCiexiffE6xrxwVJeRy6RJ5rdBKVaiOl9AYwr384Q45s5F udoH35cGSPMdrxfbNURdjxtgLzcRTk0yLOoL4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; b=TK0RfhhFasaNh3mghFAcEmscgcGLRFGhkZX9wE4a2AODhN9o5aMeKbL/Y0HFO7hyUV efvCykWMWu0aAkOcyeJi8n0aMxr2G8oUMQt9JjDVoHjP8d4Dce3Edt0dinTX4Uak1vSz CMJ/T0UELUygfwe4AoHvB4HnHAGIKhP4ixxYc= Received: by 10.14.119.1 with SMTP id m1mr6091131eeh.1.1290538366874; Tue, 23 Nov 2010 10:52:46 -0800 (PST) Received: from localhost ([139.91.73.37]) by mx.google.com with ESMTPS id v51sm6088036eeh.10.2010.11.23.10.52.28 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 23 Nov 2010 10:52:41 -0800 (PST) Date: Tue, 23 Nov 2010 20:52:24 +0200 From: Nick Kossifidis To: ath5k-devel@venema.h4ckr.net, linux-wireless@vger.kernel.org Cc: linville@tuxdriver.com, me@bobcopeland.com, mcgrof@gmail.com, jirislaby@gmail.com, nbd@openwrt.org, br1@einfach.org Subject: [PATCH 07/30] ath5k: Check RXE when setting RXDP Message-ID: <20101123185224.GG4303@makis.mantri> Mail-Followup-To: ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org, linville@tuxdriver.com, me@bobcopeland.com, mcgrof@gmail.com, jirislaby@gmail.com, nbd@openwrt.org, br1@einfach.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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, 23 Nov 2010 19:00:37 +0000 (UTC) diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index 629a5ee..b36d3a5 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h @@ -1168,7 +1168,7 @@ void ath5k_hw_set_clockrate(struct ath5k_hw *ah); void ath5k_hw_start_rx_dma(struct ath5k_hw *ah); int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah); u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah); -void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr); +int ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr); int ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue); int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue); u32 ath5k_hw_get_txdp(struct ath5k_hw *ah, unsigned int queue); diff --git a/drivers/net/wireless/ath/ath5k/dma.c b/drivers/net/wireless/ath/ath5k/dma.c index bfdfcff..3fe634f 100644 --- a/drivers/net/wireless/ath/ath5k/dma.c +++ b/drivers/net/wireless/ath/ath5k/dma.c @@ -95,11 +95,18 @@ u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah) * @ah: The &struct ath5k_hw * @phys_addr: RX descriptor address * - * XXX: Should we check if rx is enabled before setting rxdp ? + * Returns -EIO if rx is active */ -void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr) +int ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr) { + if (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) { + ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, + "tried to set RXDP while rx was active !\n"); + return -EIO; + } + ath5k_hw_reg_write(ah, phys_addr, AR5K_RXDP); + return 0; }