Received: by 10.223.164.221 with SMTP id h29csp356658wrb; Fri, 3 Nov 2017 16:09:44 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Th48wpKfsMxHcrXPKmJpKlKIM1G/3ZkwgpDUN43u/PeAH68QlOeiBqK2PUamtbOhBi2ddD X-Received: by 10.98.150.149 with SMTP id s21mr9117089pfk.151.1509750584686; Fri, 03 Nov 2017 16:09:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509750584; cv=none; d=google.com; s=arc-20160816; b=xg+Qtfi+b7e4PpXkM5sMHmAQSEDWaN7zosm47PCfJIQCt33QdRX7QpvRRwfuaH5aMo HgJJIK8Sf5oWIudBSY3yk6Um5xbYXpFSEv/VCkUVmw0NdI/h/NZJxao7PtTyOyPtRfCY 0LJwf8ZRdc3GZjkco09PIDuXYjAWs/pJfYcE/iGM6FMCyzxgLWdgQaPw18xJeF0WPPhN 5yTUJfUwfAebYifANjRPUUweOzFulVwTwczw0i1XEgO1NREPv/3wIjx1wzbbpOcSXAFW wOC2MQP+yzR/yJVtSyfVadIR9k+BiKetzT3+1kC22QxzfWTvHvOCDCDdyoSNgk9pYQn2 xTNg== 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=aap/diGKZE8XpYMVz6u0HIHICNkgK87KPHnC4Vv/6c4=; b=CrK0AKfv6PxYYX96MQwlUJkb0sVd2EbACOvyYgF3aayIctFX4+ASfOH9OeW7dawRle 5GubBaBPJba02YdmCzMKoWqnmyoiZMORkHBp/2VK8kVKiYZlbBIpWMUrXuv/QnqaoSob HvdmonknvjVzTVH1aCJT9ZeV9aI45f+lJr2m2hg+MUrj3UIH6AdTVI+sGiJwkoo5QttB cP6w32aXGTT/L6SBdeO1U0Ui0VIUn/sXq2+HR9qer85Yqr16vL4aC6JlSow9mnxrB4gP 2cvvWwvoc1UGIsAcKgH2v2lX6lPX76BcXNcrvdvLU7GFnJMXWCrWRJXx2m9K1bKsyYus KW5g== 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 l12si7404135pfd.342.2017.11.03.16.09.32; Fri, 03 Nov 2017 16:09:44 -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 S1756632AbdKCXIj (ORCPT + 92 others); Fri, 3 Nov 2017 19:08:39 -0400 Received: from mail.savoirfairelinux.com ([208.88.110.44]:33324 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756370AbdKCXF7 (ORCPT ); Fri, 3 Nov 2017 19:05:59 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id B33F29C2F4B; Fri, 3 Nov 2017 19:05:58 -0400 (EDT) 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 DlCqG3C77wcJ; Fri, 3 Nov 2017 19:05:46 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id AE7C19C2F59; Fri, 3 Nov 2017 19:05:46 -0400 (EDT) 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 k6D3nMo-KMAI; Fri, 3 Nov 2017 19:05:46 -0400 (EDT) Received: from weeman.mtl.sfl (unknown [192.168.49.192]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 7E4859C2F43; Fri, 3 Nov 2017 19:05:46 -0400 (EDT) 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 02/11] net: dsa: make tree index unsigned Date: Fri, 3 Nov 2017 19:05:21 -0400 Message-Id: <20171103230530.996-3-vivien.didelot@savoirfairelinux.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171103230530.996-1-vivien.didelot@savoirfairelinux.com> References: <20171103230530.996-1-vivien.didelot@savoirfairelinux.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Similarly to a DSA switch and port, rename the tree index from "tree" to "index" and make it an unsigned int because it isn't supposed to be less than 0. u32 is an OF specific data used to retrieve the value and has no need to be propagated up to the tree index. Signed-off-by: Vivien Didelot --- include/net/dsa.h | 2 +- net/dsa/dsa2.c | 14 +++++++------- net/dsa/slave.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index fa1c21ab8092..e54332968417 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -116,7 +116,7 @@ struct dsa_switch_tree { struct raw_notifier_head nh; /* Tree identifier */ - u32 tree; + unsigned int index; /* Number of switches attached to this tree */ struct kref refcount; diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 797d1156b4e6..8b68dc2f5707 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -27,12 +27,12 @@ static DEFINE_MUTEX(dsa2_mutex); static const struct devlink_ops dsa_devlink_ops = { }; -static struct dsa_switch_tree *dsa_get_dst(u32 tree) +static struct dsa_switch_tree *dsa_get_dst(unsigned int index) { struct dsa_switch_tree *dst; list_for_each_entry(dst, &dsa_switch_trees, list) - if (dst->tree == tree) { + if (dst->index == index) { kref_get(&dst->refcount); return dst; } @@ -53,14 +53,14 @@ static void dsa_put_dst(struct dsa_switch_tree *dst) kref_put(&dst->refcount, dsa_free_dst); } -static struct dsa_switch_tree *dsa_add_dst(u32 tree) +static struct dsa_switch_tree *dsa_add_dst(unsigned int index) { struct dsa_switch_tree *dst; dst = kzalloc(sizeof(*dst), GFP_KERNEL); if (!dst) return NULL; - dst->tree = tree; + dst->index = index; INIT_LIST_HEAD(&dst->list); list_add_tail(&dsa_switch_trees, &dst->list); kref_init(&dst->refcount); @@ -454,7 +454,7 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst) dst->cpu_dp = NULL; - pr_info("DSA: tree %d unapplied\n", dst->tree); + pr_info("DSA: tree %d unapplied\n", dst->index); dst->applied = false; } @@ -504,7 +504,7 @@ static int dsa_ds_parse(struct dsa_switch_tree *dst, struct dsa_switch *ds) } - pr_info("DSA: switch %d %d parsed\n", dst->tree, ds->index); + pr_info("DSA: switch %d %d parsed\n", dst->index, ds->index); return 0; } @@ -549,7 +549,7 @@ static int dsa_dst_parse(struct dsa_switch_tree *dst) } } - pr_info("DSA: tree %d parsed\n", dst->tree); + pr_info("DSA: tree %d parsed\n", dst->index); return 0; } diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 9b75d0ac4092..814ced75a0cc 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -55,7 +55,7 @@ void dsa_slave_mii_bus_init(struct dsa_switch *ds) ds->slave_mii_bus->read = dsa_slave_phy_read; ds->slave_mii_bus->write = dsa_slave_phy_write; snprintf(ds->slave_mii_bus->id, MII_BUS_ID_SIZE, "dsa-%d.%d", - ds->dst->tree, ds->index); + ds->dst->index, ds->index); ds->slave_mii_bus->parent = ds->dev; ds->slave_mii_bus->phy_mask = ~ds->phys_mii_mask; } -- 2.14.3 From 1583463478922645100@xxx Wed Nov 08 02:34:10 +0000 2017 X-GM-THRID: 1583316459934289833 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread