[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200414115604.GF1163@kadam>
Date: Tue, 14 Apr 2020 14:56:05 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Ivan Safonov <isaf21@...dex.ru>
Cc: Nishka Dasgupta <nishkadg.linux@...il.com>,
Larry Finger <Larry.Finger@...inger.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Michael Straube <straube.linux@...il.com>,
devel@...verdev.osuosl.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 5/8] staging: rtl8188eu: Remove function rtw_modular64()
On Sun, Apr 12, 2020 at 04:34:08PM +0300, Ivan Safonov wrote:
> > Remove function rtw_modular64 as all it does is call do_div.
>
> This is wrong. Macro do_div(x, y) change first argument x, but
> rtw_modular64(x, y) preserve it.
>
> > + tsf = pmlmeext->TSFValue - do_div(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) - 1024; /* us */
>
> rounddown(pmlmeext->TSFValue, pmlmeinfo->bcn_interval * 1024) - 1024
> is a better replacement for
You're absolutely correct that the patch is buggy, but I'm not sure that
rounddown() is what we want.
rtw_modular64() took the MOD of x. So it should be something like:
tsf = pmlmeext->TSFValue - (pmlmeext->TSFValue % (pmlmeinfo->bcn_interval * 1024)) - 1024; /* us */
But what the heck is that even??? If pmlmeinfo->bcn_interval is zero
or one then the subtraction ends up giving us a negative.
regards,
dan carpenter
Powered by blists - more mailing lists