All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Sascha Hauer <sha@pengutronix.de>,
	Bitterblue Smith <rtl8821cerfe2@gmail.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"Sean Mollet" <sean@malmoset.com>
Subject: RE: [PATCH 1/4] wifi: rtw88: 8821cu: Fix firmware upload fail
Date: Thu, 29 Feb 2024 01:37:08 +0000	[thread overview]
Message-ID: <d03453973370468aaf5213d61e8e3089@realtek.com> (raw)
In-Reply-To: <Zd71FWoTDn5plI5R@pengutronix.de>



> -----Original Message-----
> From: Sascha Hauer <sha@pengutronix.de>
> Sent: Wednesday, February 28, 2024 4:56 PM
> To: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> Cc: linux-wireless@vger.kernel.org; Ping-Ke Shih <pkshih@realtek.com>; Sean Mollet <sean@malmoset.com>
> Subject: Re: [PATCH 1/4] wifi: rtw88: 8821cu: Fix firmware upload fail
> 
> On Tue, Feb 27, 2024 at 06:27:51PM +0200, Bitterblue Smith wrote:
> > Adding Sean Mollet because I forgot earlier.
> >
> > On 27/02/2024 14:56, Sascha Hauer wrote:
> > > On Tue, Feb 27, 2024 at 02:18:20PM +0200, Bitterblue Smith wrote:
> > >> +  if (addr < 0xFE00) {
> > >> +          if (addr <= 0xff)
> > >> +                  current_reg_sec = REG_ON_SEC;
> > >> +          else if (0x1000 <= addr && addr <= 0x10ff)
> > >> +                  current_reg_sec = REG_ON_SEC;
> > >> +          else
> > >> +                  current_reg_sec = REG_OFF_SEC;
> > >> +  } else {
> > >> +          current_reg_sec = REG_LOCAL_SEC;
> > >> +  }
> > >> +
> > >> +  if (current_reg_sec != REG_ON_SEC)
> > >> +          return;
> > >
> > > Is there something we want to do with current_reg_sec == REG_LOCAL_SEC
> > > or current_reg_sec == REG_OFF_SEC later? If not the above could be
> > > rewritten as:
> > >
> > >     if (addr > 0xff && addr < 0x1000)
> > >             return;
> > >     if (addr > 0x10ff)
> > >             return;
> > >
> > >     ...
> >
> > Dunno, I just copied the code from the other drivers:
> >
> >
> https://github.com/morrownr/8821cu-20210916/blob/5b39398e2de146edeb76716420f3288f508bea61/os_dep/linux
> /usb_ops_linux.c#L171
> 
> Ok, nothing is done with current_reg_sec here as well, so I suggest
> rewriting the check like I suggested.

I also prefer rewriting the code, but we can add comments to describe there
are three sections: 
  1. on (0x00~0xFF;0x1000~0x10FF): this section is always powered on
  2. off (< 0xFE00; but not on section): this section could be powered off
  3. local (>= 0xFE00): usb specific registers section 

Since only on-section needs special deal, maybe positively listing register
ranges would be clear, like

	bool reg_on_sec = false;

	if ((addr >= 0x00 && addr <= 0xFF) ||
	    (addr >= 0x1000 && addr <= 0x10FF))
		reg_on_sec = true;

	if (!reg_on_sec)
		return;

Ping-Ke


  reply	other threads:[~2024-02-29  1:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 12:18 [PATCH 1/4] wifi: rtw88: 8821cu: Fix firmware upload fail Bitterblue Smith
2024-02-27 12:56 ` Sascha Hauer
2024-02-27 16:27   ` Bitterblue Smith
2024-02-28  8:55     ` Sascha Hauer
2024-02-29  1:37       ` Ping-Ke Shih [this message]
2024-02-29  1:43         ` Ping-Ke Shih
2024-02-28  8:56 ` Sascha Hauer

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=d03453973370468aaf5213d61e8e3089@realtek.com \
    --to=pkshih@realtek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rtl8821cerfe2@gmail.com \
    --cc=sean@malmoset.com \
    --cc=sha@pengutronix.de \
    /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.