All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Ivan Safonov <isaf21@yandex.ru>
Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michael Straube <straube.linux@gmail.com>,
	devel@driverdev.osuosl.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/8] staging: rtl8188eu: Remove function rtw_modular64()
Date: Tue, 14 Apr 2020 14:56:05 +0300	[thread overview]
Message-ID: <20200414115604.GF1163@kadam> (raw)
In-Reply-To: <66fb1e37-107e-54f4-4986-ca4e4bb99d2d@yandex.ru>

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


  reply	other threads:[~2020-04-14 11:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190712071746.2474-5-nishkadg.linux@gmail.com>
2020-04-12 13:34 ` [PATCH 5/8] staging: rtl8188eu: Remove function rtw_modular64() Ivan Safonov
2020-04-14 11:56   ` Dan Carpenter [this message]
2020-04-14 12:22     ` Ivan Safonov
2020-04-14 13:25       ` Dan Carpenter

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=20200414115604.GF1163@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=isaf21@yandex.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nishkadg.linux@gmail.com \
    --cc=straube.linux@gmail.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.