linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Jes.Sorensen@redhat.com, linux-wireless@vger.kernel.org
Cc: kvalo@codeaurora.org, Larry.Finger@lwfinger.net
Subject: Re: [PATCH 1/1] New driver: rtl8xxxu (mac80211)
Date: Mon, 31 Aug 2015 16:48:37 +0200	[thread overview]
Message-ID: <1441032517.13980.21.camel@sipsolutions.net> (raw)
In-Reply-To: <1440883083-32498-2-git-send-email-Jes.Sorensen@redhat.com> (sfid-20150829_231820_002785_12E86989)

> + * This driver was written as a replacement for the vendor provided
> + * rtl8723au driver. As the Realtek 8xxx chips are very similar in
> + * their programming interface, I have started adding support for
> + * additional 8xxx chips like the 8192cu, 8188cus, etc.

That last sentence here seems like it might be more suitable in the
commit message then here - you'll surely forget to update it ;)

> +> 	> /*
> +> 	>  * MBOX ready?
> +> 	>  */
> +> 	> retry = 100;
> +> 	> do {
> +> 	> 	> val8 = rtl8xxxu_read8(priv, REG_HMTFR);
> +> 	> 	> if (!(val8 & BIT(mbox_nr)))
> +> 	> 	> 	> break;
> +> 	> } while (retry--);

Seems fishy without any delay in the loop?

> +> 	> val32 = rtl8xxxu_read32(priv, REG_OFDM0_TRX_PATH_ENABLE);
> +> 	> val32 &= ~OFDM_RF_PATH_TX_MASK;
> +> 	> if (priv->tx_paths == 2)


"TX path" is very uncommon language for this... I'd suggest changing
all that to "TX stream" or "TX chain"?

> +> 	> if (priv->rf_paths == 2)

Similar here - and should that be RX not RF?

> +static int rtl8723a_channel_to_group(int channel)
> +{
> +> 	> int group;
> +
> +> 	> if (channel < 4)
> +> 	> 	> group = 0;
> +> 	> else if (channel < 10)
> +> 	> 	> group = 1;
> +> 	> else
> +> 	> 	> group = 2;
> +
> +> 	> return group;
> +}

Could remove the group variable, it's kinda pointless - just return
immediately?

if (channel < 4)
	return 0;
if (channel < 10)
	return 1;
return 2;


> +> 	> /* Poll for data read */
> +> 	> val32 = rtl8xxxu_read32(priv, REG_EFUSE_CTRL);
> +> 	> for (i = 0; i < RTL8XXXU_MAX_REG_POLL; i++) {
> +> 	> 	> val32 = rtl8xxxu_read32(priv, REG_EFUSE_CTRL);
> +> 	> 	> if (val32 & BIT(31))
> +> 	> 	> 	> break;
> +> 	> }
> 

Hmm, similar poll loop like above w/o any delay?
A few more seem to exist too.

> +> 	> 	> 	> for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) {
> +> 	> 	> 	> 	> /* Check word enable condition in the section */
> +> 	> 	> 	> 	> if (!(word_mask & BIT(i))) {
> +> 	> 	> 	> 	> 	> ret = rtl8xxxu_read_efuse8(priv,
> +> 	> 	> 	> 	> 	> 	> 	> 	>    efuse_addr++,
> +> 	> 	> 	> 	> 	> 	> 	> 	>    &val8);
> +> 	> 	> 	> 	> 	> if (ret)
> +> 	> 	> 	> 	> 	> 	> goto exit;
> +> 	> 	> 	> 	> 	> priv->efuse_wifi.raw[map_addr++] = val8;
> +
> +> 	> 	> 	> 	> 	> ret = rtl8xxxu_read_efuse8(priv,
> +> 	> 	> 	> 	> 	> 	> 	> 	>    efuse_addr++,
> +> 	> 	> 	> 	> 	> 	> 	> 	>    &val8);
> +> 	> 	> 	> 	> 	> if (ret)
> +> 	> 	> 	> 	> 	> 	> goto exit;
> +> 	> 	> 	> 	> 	> priv->efuse_wifi.raw[map_addr++] = val8;
> +> 	> 	> 	> 	> } else
> +> 	> 	> 	> 	> 	> map_addr += 2;
> +> 	> 	> 	> }

seems like it might better be in a helper function :)

> +static int rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv,
> +> 	> 	> 	> 	>   struct rtl8xxxu_reg32val *array)
> +{
> +> 	> int i, ret;
> +> 	> u16 reg;
> +> 	> u32 val;
> +
> +> 	> for (i = 0; ; i++) {
> +> 	> 	> reg = array[i].reg;
> +> 	> 	> val = array[i].val;
> +
> +> 	> 	> if (reg == 0xffff && val == 0xffffffff)
> +> 	> 	> 	> break;


Maybe passing ARRAY_SIZE to these would be nicer than having to they're
terminated? Dunno though, might be a lot of infrastructure to do that.

Ugh, getting too long for me - anything in particular I should look at?
:)

johannes

  parent reply	other threads:[~2015-08-31 14:48 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-29 21:18 [PATCH 0/1] rtl8xxxu (mac80211) driver for rtl8188[cr]u/rtl8192cu/rtl8723au Jes.Sorensen
2015-08-29 21:18 ` [PATCH 1/1] New driver: rtl8xxxu (mac80211) Jes.Sorensen
2015-08-30  4:42   ` Larry Finger
2015-08-30 18:41     ` Jes Sorensen
2015-08-30 21:02       ` Jes Sorensen
2015-08-30 23:51       ` Larry Finger
2015-08-31  2:39         ` Jes Sorensen
2015-08-31 15:45           ` Larry Finger
2015-08-31 23:43             ` Jes Sorensen
2015-09-01  0:16               ` Larry Finger
2015-09-01  4:54                 ` Jes Sorensen
2015-09-01  5:17                   ` Larry Finger
2015-09-01  5:26                     ` Jes Sorensen
2015-08-31  1:06       ` Joe Perches
2015-08-31 13:11         ` Jes Sorensen
2015-08-31  8:19       ` Johannes Berg
2015-08-31 14:48   ` Johannes Berg [this message]
2015-08-31 23:42     ` Jes Sorensen
2015-09-01 15:07       ` Johannes Berg
2015-09-03  1:59         ` Jes Sorensen
2015-09-03  2:39           ` Jes Sorensen
2015-09-03 10:17             ` Johannes Berg
2015-09-04 18:24               ` Jes Sorensen
2015-09-04 18:25                 ` Johannes Berg
2015-09-05  4:02                 ` Sujith Manoharan
2015-09-17 16:46                   ` Johannes Berg
2015-10-05 18:49                     ` Jes Sorensen
2015-10-05 18:56                       ` Johannes Berg
2015-10-05 19:04                         ` Jes Sorensen
2015-10-05 19:12                           ` Johannes Berg
2015-10-05 19:19                             ` Jes Sorensen
2015-10-05 19:20                               ` Johannes Berg
2015-10-05 19:53                                 ` Jes Sorensen
2015-09-03 10:17           ` Johannes Berg
2015-09-04 17:48             ` Jes Sorensen
2015-09-04 18:02               ` Johannes Berg
2015-10-08 16:23   ` Jakub Sitnicki
2015-10-08 19:09     ` Jes Sorensen
2015-10-08 20:33       ` Stefan Lippers-Hollmann
2015-10-08 21:06         ` Jes Sorensen
2015-10-08 21:03       ` Jes Sorensen
2015-10-10  4:17       ` Taehee Yoo
2015-08-30 16:49 ` [PATCH 0/1] rtl8xxxu (mac80211) driver for rtl8188[cr]u/rtl8192cu/rtl8723au Larry Finger
2015-08-30 18:45   ` Jes Sorensen
  -- strict thread matches above, loose matches on Subject: below --
2015-08-30 21:02 [PATCH v2 " Jes.Sorensen
2015-08-30 21:02 ` [PATCH 1/1] New driver: rtl8xxxu (mac80211) Jes.Sorensen
2015-09-06 14:59   ` Kalle Valo
2015-09-06 17:06     ` Larry Finger
2015-09-07  1:41       ` Jes Sorensen
2015-09-07  1:40     ` Jes Sorensen
2015-09-07 13:20       ` Kalle Valo
2015-09-07 21:08         ` Jes Sorensen
2015-10-15  0:44 [PATCH v3 0/1] rtl8xxxu (mac80211) driver for rtl8188[cr]u/rtl8192cu/rtl8723au Jes.Sorensen
2015-10-15  0:44 ` [PATCH 1/1] New driver: rtl8xxxu (mac80211) Jes.Sorensen
2015-10-15 12:09   ` Bruno Randolf
2015-10-15 12:16     ` Jes Sorensen
2015-10-23 13:07 Xose Vazquez Perez
2015-10-23 14:00 ` Jes Sorensen
2015-10-23 16:09   ` Jes Sorensen

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=1441032517.13980.21.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=Jes.Sorensen@redhat.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).