All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nik Nyby <nikolas@gnu.org>
To: linux-wireless@vger.kernel.org, pkshih@realtek.com,
	Larry.Finger@lwfinger.net
Subject: rtl8821ae dbi read question
Date: Sat, 4 Nov 2017 19:27:52 -0400	[thread overview]
Message-ID: <d46763ef-14d1-a6fa-fb33-a0bd676ef056@gnu.org> (raw)

In drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c, we have this 
function:

  static u8 _rtl8821ae_dbi_read(struct rtl_priv *rtlpriv, u16 addr)
  {
      u16 read_addr = addr & 0xfffc;
      u8 tmp = 0, count = 0, ret = 0;

      rtl_write_word(rtlpriv, REG_DBI_ADDR, read_addr);
      rtl_write_byte(rtlpriv, REG_DBI_FLAG, 0x2);
      tmp = rtl_read_byte(rtlpriv, REG_DBI_FLAG);
      count = 0;
      while (tmp && count < 20) {
          udelay(10);
          tmp = rtl_read_byte(rtlpriv, REG_DBI_FLAG);
          count++;
      }
      if (0 == tmp) {
          read_addr = REG_DBI_RDATA + addr % 4;
          ret = rtl_read_word(rtlpriv, read_addr);
      }
      return ret;
  }

Near the end of the function, in this line:

   ret = rtl_read_word(rtlpriv, read_addr);

rtl_read_word() returns a u16, but "ret" is declared as a u8. Is that a 
problem, or is this code correct?

What's prompting this question is that I'm getting frequent disconnects 
from my access point with my rtl8821ae device. I've experienced this 
behavior both before and after the recent change to this function in 
commit b8b8b16352cd90c6083033fd4487f04fae935c18.

             reply	other threads:[~2017-11-04 23:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-04 23:27 Nik Nyby [this message]
2017-11-05 16:50 ` rtl8821ae dbi read question Larry Finger
2017-11-05 20:53   ` Nik Nyby
2017-11-06  1:46     ` Larry Finger
2017-11-05 21:15   ` Nik Nyby
2017-11-05 21:29     ` James Cameron
2017-11-06  2:09     ` Larry Finger
2017-11-06  4:09       ` Nik Nyby
2017-11-06 13:52         ` Larry Finger
2017-11-19  0:39           ` Nik Nyby

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=d46763ef-14d1-a6fa-fb33-a0bd676ef056@gnu.org \
    --to=nikolas@gnu.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.