From: Gaurav Pathak <gauravpathak129@gmail.com>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Dan Carpenter <error27@gmail.com>,
paskripkin@gmail.com, phil@philpotter.co.uk,
gregkh@linuxfoundation.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH] staging: r8188eu: Used u16 instead of __le16 in rtl8188e_set_FwMediaStatus_cmd()
Date: Tue, 10 Jan 2023 23:08:55 +0530 [thread overview]
Message-ID: <Y72ir/dZtUa6tIX2@gaurav-pc.bbrouter> (raw)
In-Reply-To: <9e3e0f34-8a6c-72ca-d86e-de63f87fd7fa@lwfinger.net>
Thanks Dan and Larry for looking into it.
I also don't have much understanding of the underlying hardware, please do let me know
of your tests on big-endin machine.
> On little-endian systems, both are no-ops, thus it does not matter
Does it mean that the patch is not required and the original implementation
is okay?
On Tue, Jan 10, 2023 at 11:00:35AM -0600, Larry Finger wrote:
> On 1/10/23 08:17, Dan Carpenter wrote:
> > On Tue, Jan 10, 2023 at 07:20:58PM +0530, Gaurav Pathak wrote:
> > > - Changed 2nd argument from __le16 to u16 to fix sparse warning
> > > "warning: incorrect type in argument 2 (different base types)"
> > > - Removed le16_to_cpu() in staging/r8188eu/hal/rtl8188e_cmd.c
> > >
> > > Signed-off-by: Gaurav Pathak <gauravpathak129@gmail.com>
> > > ---
> > > drivers/staging/r8188eu/hal/rtl8188e_cmd.c | 4 ++--
> > > drivers/staging/r8188eu/include/rtl8188e_cmd.h | 2 +-
> > > 2 files changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
> > > index 8310d7f53982..a055e71d30ae 100644
> > > --- a/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
> > > +++ b/drivers/staging/r8188eu/hal/rtl8188e_cmd.c
> > > @@ -193,9 +193,9 @@ void rtl8188e_set_FwPwrMode_cmd(struct adapter *adapt, u8 Mode)
> > > }
> > > -void rtl8188e_set_FwMediaStatus_cmd(struct adapter *adapt, __le16 mstatus_rpt)
> > > +void rtl8188e_set_FwMediaStatus_cmd(struct adapter *adapt, u16 mstatus_rpt)
> > > {
> > > - u16 mst_rpt = le16_to_cpu(mstatus_rpt);
> > > + u16 mst_rpt = mstatus_rpt;
> >
> > You are changing the behavior of the code here for big endian systems.
> > Either the change is good or bad. TLDR; I suspect the change is bad but
> > I don't know.
> >
> > The mstatus_rpt is CPU endian. It is the one of two things for connect
> > or disconnect:
> >
> > connect: (psta->mac_id << 8) | 1
> > disconnect: (psta->mac_id << 8) | 0
> >
> > So the question is in FillH2CCmd_88E() should the connect/disconnect
> > come before the mac_id as it currently does or should it only work that
> > way on little endian systems and be reversed on big endian systems?
> > My feeling is that the second option makes no sense so this patch is not
> > correct.
> >
> > Instead what should happen is:
> >
> > -void rtl8188e_set_FwMediaStatus_cmd(struct adapter *adapt, __le16 mstatus_rpt)
> > +void rtl8188e_set_FwMediaStatus_cmd(struct adapter *adapt, u16 mstatus_rpt)
> > {
> > - u16 mst_rpt = le16_to_cpu(mstatus_rpt);
> > + __le16 mst_rpt = cpu_to_le16(mstatus_rpt);
> >
> > But this is just my intuition and I don't know this hardware.
>
> I agree with Dan. This patch was attacking the symptom, not the cause. The
> original Realtek driver confuses cpu_to_le16() with le16_to_cpu() in many
> places. Apparently, I missed this one. On little-endian systems, both are
> no-ops, thus it does not matter.
>
> I have a big-endian system (PowerBook G4) and will test later today.
>
> Larry
>
>
next prev parent reply other threads:[~2023-01-10 17:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 13:50 [PATCH] staging: r8188eu: Used u16 instead of __le16 in rtl8188e_set_FwMediaStatus_cmd() Gaurav Pathak
2023-01-10 14:17 ` Dan Carpenter
2023-01-10 17:00 ` Larry Finger
2023-01-10 17:38 ` Gaurav Pathak [this message]
2023-01-13 17:38 ` Larry Finger
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=Y72ir/dZtUa6tIX2@gaurav-pc.bbrouter \
--to=gauravpathak129@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-staging@lists.linux.dev \
--cc=paskripkin@gmail.com \
--cc=phil@philpotter.co.uk \
/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