netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Mc Guire <der.herr@hofr.at>
To: Joe Perches <joe@perches.com>
Cc: Nicholas Mc Guire <hofrat@osadl.org>,
	Brett Rudley <brudley@broadcom.com>,
	Arend van Spriel <arend@broadcom.com>,
	"Franky (Zhenhui) Lin" <frankyl@broadcom.com>,
	Hante Meuleman <meuleman@broadcom.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	"John W. Linville" <linville@tuxdriver.com>,
	Pieter-Paul Giesberts <pieterpg@broadcom.com>,
	Daniel Kim <dekim@broadcom.com>,
	Johannes Berg <johannes.berg@intel.com>,
	linux-wireless@vger.kernel.org, brcm80211-dev-list@broadcom.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] brcmfmac: cfg80211: use msecs_to_jiffies for time conversion
Date: Wed, 18 Mar 2015 07:44:39 +0100	[thread overview]
Message-ID: <20150318064439.GA25924@opentech.at> (raw)
In-Reply-To: <1426596159.23897.61.camel@perches.com>

On Tue, 17 Mar 2015, Joe Perches wrote:

> On Tue, 2015-03-17 at 08:06 -0400, Nicholas Mc Guire wrote:
> > Converting milliseconds to jiffies by "val * HZ / 1000" is technically
> > OK but msecs_to_jiffies(val) is the cleaner solution and handles all
> > corner cases correctly. This is a minor API consolidation only and
> > should make things more readable.
> 
> Hi Nicholas
> 
> These API consolidation changes now always have a function
> call when the compiler may have previously been able to
> optimize out the "constant * HZ / 1000" calculation.
>
> Perhaps the [um]secs_to_jiffies calls should be indirected
> with yet another static inline with a __builtin_constant_p()
> test so that the function calls can again be avoided when
> possible.

will give it a try 

> 
> (and a trivial style note)
> 
> > diff --git a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
> []
> > @@ -1110,7 +1110,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif,
> >  
> >  	/* Arm scan timeout timer */
> >  	mod_timer(&cfg->escan_timeout, jiffies +
> > -			WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
> > +		  msecs_to_jiffies(WL_ESCAN_TIMER_INTERVAL_MS));
> 
> It may be nicer to keep the arithmetic on one line

sorry that was plain carelessness afer it went over 80 char.

> 
>  	mod_timer(&cfg->escan_timeout,
> 		  jiffies + msecs_to_jiffies(WL_ESCAN_TIMER_INTERVAL_MS));
>

thx!
hofrat 

  reply	other threads:[~2015-03-18  6:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 12:06 [PATCH] brcmfmac: cfg80211: use msecs_to_jiffies for time conversion Nicholas Mc Guire
2015-03-17 12:42 ` Joe Perches
2015-03-18  6:44   ` Nicholas Mc Guire [this message]
     [not found]     ` <20150318064439.GA25924-AxMHDufBahDk7+2FdBfRIA@public.gmane.org>
2015-03-18  7:30       ` Joe Perches
2015-03-17 16:04 ` Arend van Spriel

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=20150318064439.GA25924@opentech.at \
    --to=der.herr@hofr.at \
    --cc=arend@broadcom.com \
    --cc=brcm80211-dev-list@broadcom.com \
    --cc=brudley@broadcom.com \
    --cc=dekim@broadcom.com \
    --cc=frankyl@broadcom.com \
    --cc=hofrat@osadl.org \
    --cc=joe@perches.com \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=meuleman@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pieterpg@broadcom.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 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).