Historical ath9k-devel archives
 help / color / mirror / Atom feed
From: Luis R. Rodriguez <lrodriguez@atheros.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [RFC PATCH 2/2] ath9k: fix mixing of interrupt masks, remove ah->mask_reg
Date: Tue, 30 Mar 2010 09:52:19 -0700	[thread overview]
Message-ID: <20100330165219.GA25095@tux> (raw)
In-Reply-To: <20100330033924.7683.13491.stgit@mj.roinet.com>

On Mon, Mar 29, 2010 at 08:39:58PM -0700, Pavel Roskin wrote:
> ah->mask_reg is used inconsistently.  ath9k_hw_init_chain_masks() uses
> it to cache the value it writes to AR_IMR.  But once
> ath9k_hw_set_interrupts() is called, ah->mask_reg starts caching the
> interrupt mask in the format used in sc->imask, which differs in several
> bits.
> 
> Use sc->imask instead of ah->mask_reg as omask ath9k_hw_set_interrupts()
> and ath9k_hw_updatetxtriglevel().  Remove ah->mask_reg, as it becomes
> write only.  Use a local variable in ath9k_hw_init_chain_masks().
> 
> Signed-off-by: Pavel Roskin <proski@gnu.org>
> Reported-by: Julia Lawall <julia@diku.dk>
> ---
> 
> Adding ath9k.h to hw.c and mac.c could raise some eyebrows, but the
> alternative is moving imask from sc to ah, which would be more
> intrusive.
> 
> I think sc and ah should be merged eventually, so all files that know
> the ah structure will know sc as well.  There is no gain from hiding sc
> from the low-level code.
> 
>  drivers/net/wireless/ath/ath9k/hw.c  |   19 +++++++++++--------
>  drivers/net/wireless/ath/ath9k/hw.h  |    1 -
>  drivers/net/wireless/ath/ath9k/mac.c |    5 ++++-
>  3 files changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
> index 77db932..791aeb9 100644
> --- a/drivers/net/wireless/ath/ath9k/hw.c
> +++ b/drivers/net/wireless/ath/ath9k/hw.c
> @@ -17,6 +17,7 @@
>  #include <linux/io.h>
>  #include <asm/unaligned.h>
>  
> +#include "ath9k.h"
>  #include "hw.h"
>  #include "rc.h"
>  #include "initvals.h"
> @@ -1120,23 +1121,25 @@ static void ath9k_hw_init_chain_masks(struct ath_hw *ah)
>  static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
>  					  enum nl80211_iftype opmode)
>  {
> -	ah->mask_reg = AR_IMR_TXERR |
> +	u32 imr_reg;
> +
> +	imr_reg = AR_IMR_TXERR |
>  		AR_IMR_TXURN |
>  		AR_IMR_RXERR |
>  		AR_IMR_RXORN |
>  		AR_IMR_BCNMISC;
>  
>  	if (ah->config.rx_intr_mitigation)
> -		ah->mask_reg |= AR_IMR_RXINTM | AR_IMR_RXMINTR;
> +		imr_reg |= AR_IMR_RXINTM | AR_IMR_RXMINTR;
>  	else
> -		ah->mask_reg |= AR_IMR_RXOK;
> +		imr_reg |= AR_IMR_RXOK;
>  
> -	ah->mask_reg |= AR_IMR_TXOK;
> +	imr_reg |= AR_IMR_TXOK;
>  
>  	if (opmode == NL80211_IFTYPE_AP)
> -		ah->mask_reg |= AR_IMR_MIB;
> +		imr_reg |= AR_IMR_MIB;
>  
> -	REG_WRITE(ah, AR_IMR, ah->mask_reg);
> +	REG_WRITE(ah, AR_IMR, imr_reg);
>  	ah->imrs2_reg |= AR_IMR_S2_GTT;
>  	REG_WRITE(ah, AR_IMR_S2, ah->imrs2_reg);
>  
> @@ -2839,10 +2842,11 @@ EXPORT_SYMBOL(ath9k_hw_getisr);
>  
>  enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints)
>  {
> -	u32 omask = ah->mask_reg;
>  	u32 mask, mask2;
>  	struct ath9k_hw_capabilities *pCap = &ah->caps;
>  	struct ath_common *common = ath9k_hw_common(ah);
> +	struct ath_softc *sc = (struct ath_softc *)common->priv;

This is exactly what I was trying to prevent, lets please try to figure out
another way, NACK for now.

Consider

struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;

  Luis

  reply	other threads:[~2010-03-30 16:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30  3:39 [ath9k-devel] [RFC PATCH 1/2] ath9k: rename symbols in enum ath9k_internal_frame_type to avoid confusion Pavel Roskin
2010-03-30  3:39 ` [ath9k-devel] [RFC PATCH 2/2] ath9k: fix mixing of interrupt masks, remove ah->mask_reg Pavel Roskin
2010-03-30 16:52   ` Luis R. Rodriguez [this message]
2010-03-31 21:54     ` Pavel Roskin
2010-03-30 16:57 ` [ath9k-devel] [RFC PATCH 1/2] ath9k: rename symbols in enum ath9k_internal_frame_type to avoid confusion Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100330165219.GA25095@tux \
    --to=lrodriguez@atheros.com \
    --cc=ath9k-devel@lists.ath9k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox