Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1207182ybe; Thu, 5 Sep 2019 11:57:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsh7pEQT8Syblz0okfaRt9ApwSbKbOvp26foSpyTTl19N1UgiPc7y72B08C+f8kyj4pfph X-Received: by 2002:a62:65c7:: with SMTP id z190mr5887484pfb.9.1567709875188; Thu, 05 Sep 2019 11:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567709875; cv=none; d=google.com; s=arc-20160816; b=mlyb6CXR/+rNdSWJCO3OqkFQWtJK4P+xY2UjwWDao/rGfhHKlJXbYHtXjf/7o0HIwN dfQ7ygWdGr7cAiiMJ5hkQuzZ8EfzOFMEtG2d2qCl6dBzylbv42+C8Ylf+wvnMs1EZLS0 4z4RZpZbxsr5uGj4QpxTchrxOdwZK9p7rGFqF5Webxw92bA2oONQMJVHWhgoandrFLBX HOYXVocp9AmOwiPLBobaREKLBfWsz3OYePh3M918+9Uh+TLVOPUqVUh5yyln8l9mkPR0 yE2WfRQvnshpkE91wXmwVKeFvcO+4AjvMR737ZbkYMTILAn7goXcL3fUnTflP2URyIaW KEuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=1P8wqUGPnH6oKGSC4psqZjT522G0eY/h9FP8X5fSZCk=; b=H+oFkNm9/bVHzHj3q23l0b1trPxLTK+0wND/ebFBmInqOJQ/+TVEF5d5k5FGsYqrA4 IH9ee5pwrFvUx5nsseN6mW7gsYIM0mn1n8fpFdsp9WGN2LpKgerYu95Kvi/t7xJD8Z04 2iTi5zcukUUZvJs+OVby+9GFkLRVRK6toQgJrZ5GbvIM5sNIfB+XrlcONJMwNaDAmy9F EjVeNQqDwbbXm+GCSHGDN40N3oBxx2HUEgyfP4lqjm0wDbyJTpgGn1+gojCayH4bvtbB jjjxaRSZfkToy7u8Ke2vgKBMGPLgM9QJTSbLSKfD3IJosjqfrk4RKK0zgYVLEPOgGePy 0i1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si2763416plp.204.2019.09.05.11.57.36; Thu, 05 Sep 2019 11:57:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389259AbfIEP44 (ORCPT + 99 others); Thu, 5 Sep 2019 11:56:56 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6232 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730753AbfIEP4z (ORCPT ); Thu, 5 Sep 2019 11:56:55 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9E58B8E3A8A51ACE7228; Thu, 5 Sep 2019 23:56:52 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Thu, 5 Sep 2019 23:56:43 +0800 From: zhong jiang To: CC: , , , , Subject: [PATCH] ethernet: micrel: Use DIV_ROUND_CLOSEST directly to make it readable Date: Thu, 5 Sep 2019 23:53:48 +0800 Message-ID: <1567698828-26825-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d but is perhaps more readable. Signed-off-by: zhong jiang --- drivers/net/ethernet/micrel/ksz884x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index 3103446..e102e15 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c @@ -2166,7 +2166,7 @@ static void sw_get_broad_storm(struct ksz_hw *hw, u8 *percent) num = (data & BROADCAST_STORM_RATE_HI); num <<= 8; num |= (data & BROADCAST_STORM_RATE_LO) >> 8; - num = (num * 100 + BROADCAST_STORM_VALUE / 2) / BROADCAST_STORM_VALUE; + num = DIV_ROUND_CLOSEST(num * 100, BROADCAST_STORM_VALUE); *percent = (u8) num; } -- 1.7.12.4