Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1809315pxb; Fri, 6 Nov 2020 22:35:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJx55+Ww7sgzeTZNrWrP+4EN8P6CoJx0swxMuca7zv/2VbeUOqWocBsHZH29lL5bqoFpHu6i X-Received: by 2002:a17:906:86c7:: with SMTP id j7mr5554116ejy.301.1604730950791; Fri, 06 Nov 2020 22:35:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604730950; cv=none; d=google.com; s=arc-20160816; b=Ezg7zoYdl9TaH8gDTq3cROKrn6Vobwt1xLSwimQJ33ri1f6CymQehVLtCpdPf2G7b0 xBgJ32qvm9jtXg8He3+/mp4lYtuHL1e8V2Cbo14QEga6sqOh3i9pjctlIfIaj4H4e9ZV 2A+C/sg6O4dUQTfOKBIoZnLXIt0R/gt77Mye3URI2KLUCNgc+RBXfHGkR1nnxzVUQnjX JulBqlxKK/kKywJvvOpFBgCw0TdDlq1sB/q2lGqO3bVP6Vuw9085BTRLIqpcMESqloZU hLkQy/uIjzgCbHiN0gi+wyUuijnTtJlr0rZCOypAuXEM3XO1ghaS9hMNlQFWyTClJP3H xdlg== 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=um31AlIV0DnDyemR5LD5JXEKfsEYpLWyo+raGoXCt15LDeENFzsGoKIb/FpY4vgtXt IIY5FEtkyGozF9H7n1t1EcadWhyclbBPE2cAl5ke4uXsINRE+AgqITFt7x+UrOHc6RXD lWQfSTBcFDYrOlsOj+ZLlU3axDH160aUY+xXzU7wZdNfpe8hwpJBRFCrS8wlKYm9ofpZ Fl2FW7SAg1DNiF6YGcb705s+BrAlDDHfcSGAAW0uvyLC75Nrt9ezAelhm2InGQgtc5iK RBX+FfHQDI3ghZfY+31JKkRdFuQEteBf/JCB1oVMnsWqTQDPEN09+aY5PE4TpbQphrwn wjuQ== 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 e14si2957218edl.270.2020.11.06.22.34.33; Fri, 06 Nov 2020 22:35:50 -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 S1728058AbgKGGbQ (ORCPT + 99 others); Sat, 7 Nov 2020 01:31:16 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:6757 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727935AbgKGGbM (ORCPT ); Sat, 7 Nov 2020 01:31:12 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CSnT14pxFzkd9x; Sat, 7 Nov 2020 14:31:01 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Sat, 7 Nov 2020 14:30:58 +0800 From: Huazhong Tan To: CC: , , , , , , Huazhong Tan Subject: [PATCH net-next 07/11] net: hns3: add hns3_state_init() to do state initialization Date: Sat, 7 Nov 2020 14:31:17 +0800 Message-ID: <1604730681-32559-8-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604730681-32559-1-git-send-email-tanhuazhong@huawei.com> References: <1604730681-32559-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