From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Yanir Lubetkin <yanirx.lubetkin@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 3/9] e1000e: remove call to do_div and sign mismatch warning
Date: Wed, 3 Jun 2015 04:27:50 -0700 [thread overview]
Message-ID: <1433330876-2658-4-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1433330876-2658-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Fixes a warning that was reported by Yanjiang Jin
<yanjiang.jin@windriver.com> by implementing the solution suggested by
Alexander Duyck <alexander.h.duyck@redhat.com>.
Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/e1000e/ich8lan.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index e18443a..d9f7b93 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -1014,7 +1014,6 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
u16 speed, duplex, scale = 0;
u16 max_snoop, max_nosnoop;
u16 max_ltr_enc; /* max LTR latency encoded */
- s64 lat_ns; /* latency (ns) */
u64 value;
u32 rxa;
@@ -1040,14 +1039,10 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
* 2^25*(2^10-1) ns. The scale is encoded as 0=2^0ns,
* 1=2^5ns, 2=2^10ns,...5=2^25ns.
*/
- lat_ns = ((s64)rxa * 1024 -
- (2 * (s64)hw->adapter->max_frame_size)) * 8 * 1000;
- if (lat_ns < 0) {
- value = 0;
- } else {
- value = lat_ns;
- do_div(value, speed);
- }
+ rxa *= 512;
+ value = (rxa > hw->adapter->max_frame_size) ?
+ (rxa - hw->adapter->max_frame_size) * (16000 / speed) :
+ 0;
while (value > PCI_LTR_VALUE_MASK) {
scale++;
--
2.1.0
next prev parent reply other threads:[~2015-06-03 11:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1433330876-2658-1-git-send-email-jeffrey.t.kirsher@intel.com>
2015-06-03 11:27 ` [net-next 1/9] e1000e: i219 fix unit hang on reset and runtime D3 Jeff Kirsher
2015-06-03 11:27 ` [net-next 2/9] e1000e: i219 execute unit hang fix on every reset or power state transition Jeff Kirsher
2015-06-03 11:27 ` Jeff Kirsher [this message]
2015-06-03 11:27 ` [net-next 4/9] e1000e: fix logical error in flush_desc_rings Jeff Kirsher
2015-06-03 11:27 ` [net-next 5/9] e1000e: fix flush_desc_ring implementation Jeff Kirsher
2015-06-03 11:27 ` [net-next 6/9] e1000e: fix legacy interrupt handling in i219 Jeff Kirsher
2015-06-03 11:27 ` [net-next 7/9] e1000e: fix systim issues Jeff Kirsher
2015-06-03 11:27 ` [net-next 8/9] e1000e: fix unit hang during loopback test Jeff Kirsher
2015-06-03 11:27 ` [net-next 9/9] e1000e: Bump the version to 3.2.5 Jeff Kirsher
2015-06-04 3:20 ` [net-next 0/9][pull request] Intel Wired LAN Driver Updates 2015-06-03 David Miller
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=1433330876-2658-4-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=jogreene@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=sassmann@redhat.com \
--cc=yanirx.lubetkin@intel.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).