Received: by 10.223.164.202 with SMTP id h10csp722291wrb; Mon, 6 Nov 2017 14:23:32 -0800 (PST) X-Google-Smtp-Source: ABhQp+Sdm8fF9USVCUkvjmqZOA83mW2+QhTpL6oHsesnwve4qtXL/495NLennCj4Y5FpPqRrWDzt X-Received: by 10.99.150.2 with SMTP id c2mr16529556pge.386.1510007012406; Mon, 06 Nov 2017 14:23:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510007012; cv=none; d=google.com; s=arc-20160816; b=bwoSxBEwu9ul/ase2XqfT7nXSBJxXbf2oaaLiXQ4J2EHMbjfI2sTBZL5baggLFAHed TOrwM7zvh6OvPRLtG/fvHw14P2FBwQAoFTv0wes+iqNsNmFnpPH1WRBARr1Mri+DL6ma 8RF9KPuHZTLhyJhn5y0c2IpYWn2WTH6uJXaHEheNOOnEXgW8+IDR45oqEKdvjgfYEJ3c NELKUP5V4tygEqNzWoUkQ6P4fzPlQwg78suOXwXDpiKSNGCP04iyoi0TzGQZz9U9LAB1 G7Vw344ucT0d2Q+xP4hM1xuhdjAtK45+aBXBo4mUNWPQTCr2B5jPZEM0FejMAbTOEmvS ESaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=2aUUbo5G5ZcopMe42gfGu5IYe8lkm7Jlcxv6HqkAIBs=; b=Bep7bahWiFmuJN2dS5H3zOJGU6eOgAthJzmIWT+fZatQwOwY4y2D8Wf+oA8d0YFx0/ D3Vj9TsxyRyO7fxLS4EvWhnX/6Mbboi3eHf4IICq+iVG3xws4zbnqrhXAcw8k3savNfh 9sW9FaLiXPVWwe12o/bMgHOec2MiYCnfZC1ReDgmsTZG0FXCIlJT2upBS2ZRuZDb2DPE Zuju9cZ0vsz6FVP/duwE139+IZwIz513s4dhjVFL6ife6yG98uYOP8Z1iTbY1CqD/oFL UU66s3eVa+Q8XijoI4AlmF60+vcWvoc2459zdWaDSEpOXT4TGoOQJGnMY79d6eI5l6Hz ZhVg== 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 s10si12217666pgf.263.2017.11.06.14.23.18; Mon, 06 Nov 2017 14:23:32 -0800 (PST) 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 S1752916AbdKFVPJ (ORCPT + 95 others); Mon, 6 Nov 2017 16:15:09 -0500 Received: from mail.savoirfairelinux.com ([208.88.110.44]:55130 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753518AbdKFVMS (ORCPT ); Mon, 6 Nov 2017 16:12:18 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 6C0229C2E59; Mon, 6 Nov 2017 16:12:17 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Exnf77Vz-HuH; Mon, 6 Nov 2017 16:12:16 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 4EA9F9C2F38; Mon, 6 Nov 2017 16:12:16 -0500 (EST) X-Virus-Scanned: amavisd-new at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id epJHYX6UUB6s; Mon, 6 Nov 2017 16:12:16 -0500 (EST) Received: from weeman.mtl.sfl (unknown [192.168.49.104]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id F27679C2F16; Mon, 6 Nov 2017 16:12:15 -0500 (EST) From: Vivien Didelot To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Florian Fainelli , Andrew Lunn , Vivien Didelot Subject: [PATCH net-next 05/11] net: dsa: setup and teardown switches Date: Mon, 6 Nov 2017 16:11:47 -0500 Message-Id: <20171106211153.26529-6-vivien.didelot@savoirfairelinux.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171106211153.26529-1-vivien.didelot@savoirfairelinux.com> References: <20171106211153.26529-1-vivien.didelot@savoirfairelinux.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patches brings no functional changes. It removes the unused dst argument from the dsa_ds_apply and dsa_ds_unapply functions, rename them to dsa_switch_setup and dsa_switch_teardown for a more explicit scope. This clarifies the steps of the setup or teardown of a switch fabric. Signed-off-by: Vivien Didelot --- net/dsa/dsa2.c | 62 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 1a8df0a177b5..2b3b2a86791d 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -362,7 +362,7 @@ static void dsa_user_port_unapply(struct dsa_port *port) } } -static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds) +static int dsa_switch_setup(struct dsa_switch *ds) { struct dsa_port *port; u32 index; @@ -433,7 +433,7 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds) return 0; } -static void dsa_ds_unapply(struct dsa_switch_tree *dst, struct dsa_switch *ds) +static void dsa_switch_teardown(struct dsa_switch *ds) { struct dsa_port *port; u32 index; @@ -469,6 +469,39 @@ static void dsa_ds_unapply(struct dsa_switch_tree *dst, struct dsa_switch *ds) } +static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) +{ + struct dsa_switch *ds; + int device; + int err; + + for (device = 0; device < DSA_MAX_SWITCHES; device++) { + ds = dst->ds[device]; + if (!ds) + continue; + + err = dsa_switch_setup(ds); + if (err) + return err; + } + + return 0; +} + +static void dsa_tree_teardown_switches(struct dsa_switch_tree *dst) +{ + struct dsa_switch *ds; + int device; + + for (device = 0; device < DSA_MAX_SWITCHES; device++) { + ds = dst->ds[device]; + if (!ds) + continue; + + dsa_switch_teardown(ds); + } +} + static int dsa_tree_setup_master(struct dsa_switch_tree *dst) { struct dsa_port *cpu_dp = dst->cpu_dp; @@ -488,8 +521,6 @@ static void dsa_tree_teardown_master(struct dsa_switch_tree *dst) static int dsa_tree_setup(struct dsa_switch_tree *dst) { - struct dsa_switch *ds; - u32 index; int err; if (dst->setup) { @@ -502,15 +533,9 @@ static int dsa_tree_setup(struct dsa_switch_tree *dst) if (err) return err; - for (index = 0; index < DSA_MAX_SWITCHES; index++) { - ds = dst->ds[index]; - if (!ds) - continue; - - err = dsa_ds_apply(dst, ds); - if (err) - return err; - } + err = dsa_tree_setup_switches(dst); + if (err) + return err; err = dsa_tree_setup_master(dst); if (err) @@ -525,21 +550,12 @@ static int dsa_tree_setup(struct dsa_switch_tree *dst) static void dsa_tree_teardown(struct dsa_switch_tree *dst) { - struct dsa_switch *ds; - u32 index; - if (!dst->setup) return; dsa_tree_teardown_master(dst); - for (index = 0; index < DSA_MAX_SWITCHES; index++) { - ds = dst->ds[index]; - if (!ds) - continue; - - dsa_ds_unapply(dst, ds); - } + dsa_tree_teardown_switches(dst); dsa_tree_teardown_default_cpu(dst); -- 2.14.3 From 1583338124821425099@xxx Mon Nov 06 17:21:43 +0000 2017 X-GM-THRID: 1583066076459230047 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread