Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2998813pxm; Mon, 28 Feb 2022 10:01:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoreyWkQQlnU8AkbcSAlQQ7oHr29ZNA30nZhC0QZ89MJtebIlk8VPMUjl8MIS9gaV57GGP X-Received: by 2002:a17:902:e746:b0:151:5c70:c03d with SMTP id p6-20020a170902e74600b001515c70c03dmr8970231plf.100.1646071304183; Mon, 28 Feb 2022 10:01:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646071304; cv=none; d=google.com; s=arc-20160816; b=xCincVD82egEyZmzgjUuhLoRX6Mv+W/xHvMPWpduwRQLb/e7Fk8gb3mgsZCHLMeVdK /f8HZcKYm6yCGCbHX6AUMXhPj5Fl0XiUMY3nnA+2R6z/AHMmC55AylTeV9w8TmgPOOP3 9RUooTILmbqKa63tBxLKhtQVczubez+74SXX4yd+0iobSDgaCTGAzzNlaJzvBBAYvupa 610i4gp/tHtwZzc7QsvNsV7t/43ZZrz+hVNO4lmfF81GoC1UYgLc6p4uk1tQLd1ox4lj 3bz5tVuuyYyFQdWY0qWzaNQXaXexTkgYApXhFUX+JzrZxQ1fSA8ZJweMOYXLmTnMQzBz C91g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=z+As3SbvcB96uKp9hdSFgy6kCRJqyIuZy1j/CPmCqkQ=; b=06V6pBSqrtSzPQoYrfWy3uPurLB+Vh6xq/nku3Zs836Kq06EHO5C9las2nnzFeYZSY wluWMHVu8m0iAhbge0IW1Wf1mMdzua98ohMkoa2a2fkYOcWRxlnzlPBZ+Zii6dXUp+uj rykPELZKetUg+tW2VbWhVXKDk91WdDCLGOIfc/KT2Q6B+MQK40doMrkCJZsksfUs+1pl PfuClD9ts2/F2dduMszdkmR6MlzTfJwGPciKUDZCaGTHoXpWso/rhaaLEqU2VTT7gKt2 G1grL07C9cPO2ZD6ZbvRzi2PX+dO4ADZxdPYGXTzi1aDKKiC+jiITjB6cv1XTUz5Qjam eH9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=nyI6o9SU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o17-20020a639211000000b00374ae6ab661si10481134pgd.732.2022.02.28.10.01.28; Mon, 28 Feb 2022 10:01:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=nyI6o9SU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237917AbiB1Qbx (ORCPT + 99 others); Mon, 28 Feb 2022 11:31:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234134AbiB1Qbx (ORCPT ); Mon, 28 Feb 2022 11:31:53 -0500 Received: from m12-18.163.com (m12-18.163.com [220.181.12.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1DFDE51E74; Mon, 28 Feb 2022 08:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=z+As3 SbvcB96uKp9hdSFgy6kCRJqyIuZy1j/CPmCqkQ=; b=nyI6o9SU3JCIhudAzFsCn ywybS+8npguQVCXN92/SQmaS9j22AWwCCn4cGnPuPQZ1SWnc5pDNVQjXl/8i55xU HhrE0DmYljUlSCQ1R7YHAKB1p5mQyvkSt3vDRQZF53IJTAdLvPAjxhOAPayzurOY irSEZe2HxGiu24juwwc5Pg= Received: from localhost (unknown [113.87.88.40]) by smtp14 (Coremail) with SMTP id EsCowAAXGVmW+Bxi8Na7FA--.9770S2; Tue, 01 Mar 2022 00:30:15 +0800 (CST) From: wudaemon To: davem@davemloft.net, kuba@kernel.org, m.grzeschik@pengutronix.de, chenhao288@hisilicon.com, arnd@arndb.de Cc: wudaemon@163.com, shenyang39@huawei.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable Date: Mon, 28 Feb 2022 16:29:55 +0000 Message-Id: <20220228162955.22819-1-wudaemon@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: EsCowAAXGVmW+Bxi8Na7FA--.9770S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tF45Gr48CF1xZF1UAFyrWFg_yoW8WFy5pF WUAay0yr48W3W0gayDJ348ZF15Gw48Ka4xGa4xK34fW34UKr90yFs5KrWjyw4UGrZ7XF1a v3yDAr9rCas3Ja7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zE2YLQUUUUU= X-Originating-IP: [113.87.88.40] X-CM-SenderInfo: 5zxgtvxprqqiywtou0bp/1tbiUBexbVWBtRhDZwAIsO X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org use time_before instead of direct compare for compatibility and remove the static next_jiffies variable Signed-off-by: wudaemon --- drivers/net/ethernet/micrel/ksz884x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index d024983815da..9d445f27abb8 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c @@ -5225,7 +5225,6 @@ static irqreturn_t netdev_intr(int irq, void *dev_id) * Linux network device functions */ -static unsigned long next_jiffies; #ifdef CONFIG_NET_POLL_CONTROLLER static void netdev_netpoll(struct net_device *dev) @@ -5361,7 +5360,7 @@ static int prepare_hardware(struct net_device *dev) struct dev_info *hw_priv = priv->adapter; struct ksz_hw *hw = &hw_priv->hw; int rc = 0; - + unsigned long next_jiffies = 0; /* Remember the network device that requests interrupts. */ hw_priv->dev = dev; rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev); @@ -5428,7 +5427,7 @@ static int netdev_open(struct net_device *dev) if (rc) return rc; for (i = 0; i < hw->mib_port_cnt; i++) { - if (next_jiffies < jiffies) + if (time_before(next_jiffies, jiffies)) next_jiffies = jiffies + HZ * 2; else next_jiffies += HZ * 1; @@ -6566,7 +6565,7 @@ static void mib_read_work(struct work_struct *work) struct ksz_port_mib *mib; int i; - next_jiffies = jiffies; + unsigned long next_jiffies = jiffies; for (i = 0; i < hw->mib_port_cnt; i++) { mib = &hw->port_mib[i]; -- 2.25.1