Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2925523pxb; Sun, 8 Nov 2020 19:24:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwz64hJvVMybngoE5QfKW7YUT+V68FI34Ae1wgmhSRBkotbiVo6OeOZZfNc6BonaseDuz3A X-Received: by 2002:a05:6402:14c6:: with SMTP id f6mr13814907edx.359.1604892259033; Sun, 08 Nov 2020 19:24:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604892259; cv=none; d=google.com; s=arc-20160816; b=nBJhEueKkx0flLXxVMEi/KRA8R6mlh6gOWc1t+iFJtChKTRgMu/KGmxAHxdEt1nz5a WUZl8okkR0c0OKrXHI3UVZ2/MyTez1e6TuqAJ+tcGhHbO6m1T2Pe0cMgcvLkZlOuwq6v M6UGKzjgirYRKv6hKLcLRhQOHYDc4BG32hN4gK8Ryj3D9Ps0Fz55e6LIrXzCqmwwP93g pntuVZGO5LupqjPkM8+d1KbU8n/yDFH1PdHliDsp+2LduK1vPpJj5KTC4smuIb15JCwx lqQFdHwK67q53lG+mTT1flcQIFhq62Gb/behCTBrQ1FK4JyQeGO01QpuZt/3x9cKlU6N xdWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=xM2+VPa8XtuF5uZAF5gQ3o4/8ApYvrVCXxKk2izAyOo=; b=tTvDXhS0Rk+QQUYzPQVUIH4xtYm7EfSppy+qyQKao9LYTrf35ZMbnv2jb+4sjWpr9d PGBcu9JSfxnM6/oJgxX7jv9x8uyCVc5VvdoIeXz8GF5n4hEGQMcrOEmmXkQBDXYeCIub EUGzI6OvfxlYJQw9FJhC5IBN0wmpBqy+WZYUNu6ZBcXYwmUgztUP7MVPFmJFWmL1EC9s sXxMyE+Key+jFgyicqwqXoYlh7LBvKZ1I4Gy97jPpm3oeE6nC/0GZSfDwv5RSlhJqw6t jIGRfqTcLJiTpsCFp4x5fmya2KknXikIBnrq8eS8qV/s3fmhjzRx95CrxivuBNA51y8v t/bA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si6530807ejz.214.2020.11.08.19.23.56; Sun, 08 Nov 2020 19:24:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729335AbgKIDWa (ORCPT + 99 others); Sun, 8 Nov 2020 22:22:30 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:7427 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729316AbgKIDW3 (ORCPT ); Sun, 8 Nov 2020 22:22:29 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4CTxBN3bsSz74SM; Mon, 9 Nov 2020 11:22:20 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Mon, 9 Nov 2020 11:22:17 +0800 From: Huazhong Tan To: CC: , , , , , , Huazhong Tan Subject: [PATCH V2 net-next 07/11] net: hns3: add hns3_state_init() to do state initialization Date: Mon, 9 Nov 2020 11:22:35 +0800 Message-ID: <1604892159-19990-8-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604892159-19990-1-git-send-email-tanhuazhong@huawei.com> References: <1604892159-19990-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To improve the readability and maintainability, add hns3_state_init() to initialize the state. Signed-off-by: Huazhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index a567557..f686723 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -4144,6 +4144,16 @@ static void hns3_info_show(struct hns3_nic_priv *priv) dev_info(priv->dev, "Max mtu size: %u\n", priv->netdev->max_mtu); } +static void hns3_state_init(struct hnae3_handle *handle) +{ + struct net_device *netdev = handle->kinfo.netdev; + struct hns3_nic_priv *priv = netdev_priv(netdev); + + set_bit(HNS3_NIC_STATE_INITED, &priv->state); + set_bit(HNS3_NIC_STATE_DIM_ENABLE, &priv->state); + handle->priv_flags |= BIT(HNAE3_PFLAG_DIM_ENABLE); +} + static int hns3_client_init(struct hnae3_handle *handle) { struct pci_dev *pdev = handle->pdev; @@ -4244,9 +4254,7 @@ static int hns3_client_init(struct hnae3_handle *handle) /* MTU range: (ETH_MIN_MTU(kernel default) - 9702) */ netdev->max_mtu = HNS3_MAX_MTU; - set_bit(HNS3_NIC_STATE_INITED, &priv->state); - set_bit(HNS3_NIC_STATE_DIM_ENABLE, &priv->state); - handle->priv_flags |= BIT(HNAE3_PFLAG_DIM_ENABLE); + hns3_state_init(handle); if (netif_msg_drv(handle)) hns3_info_show(priv); -- 2.7.4