From: Florian Fainelli <f.fainelli@gmail.com>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
"David S. Miller" <davem@davemloft.net>,
Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH net-next 3/7] net: dsa: get port type at parse time
Date: Mon, 30 Oct 2017 11:39:01 -0700 [thread overview]
Message-ID: <d45c07a3-940b-e2f3-8011-e44ca074a502@gmail.com> (raw)
In-Reply-To: <20171027195519.5931-4-vivien.didelot@savoirfairelinux.com>
On 10/27/2017 12:55 PM, Vivien Didelot wrote:
> Assign a port's type at parsed time instead of waiting for the tree to
> be completed.
>
> Because this is now done earlier, we can use the port's type in
> dsa_port_is_* helpers instead of digging again in topology description.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
One nit below:
> static int dsa_port_parse_of(struct dsa_port *dp, struct device_node *dn)
> {
> + struct device_node *ethernet = of_parse_phandle(dn, "ethernet", 0);
> + struct device_node *link = of_parse_phandle(dn, "link", 0);
> +
> + if (ethernet) {
> + dp->type = DSA_PORT_TYPE_CPU;
> + } else if (link) {
> + dp->type = DSA_PORT_TYPE_DSA;
> + } else {
> + dp->type = DSA_PORT_TYPE_USER;
> + }
> +
The curly braces are probably not necessary since all of these are
single line statements.
> dp->dn = dn;
>
> return 0;
> @@ -630,6 +629,14 @@ static int dsa_parse_ports_of(struct device_node *dn, struct dsa_switch *ds)
> static int dsa_port_parse(struct dsa_port *dp, const char *name,
> struct device *dev)
> {
> + if (!strcmp(name, "cpu")) {
> + dp->type = DSA_PORT_TYPE_CPU;
> + } else if (!strcmp(name, "dsa")) {
> + dp->type = DSA_PORT_TYPE_DSA;
> + } else {
> + dp->type = DSA_PORT_TYPE_USER;
> + }
Likewise.
--
Florian
next prev parent reply other threads:[~2017-10-30 18:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-27 19:55 [PATCH net-next 0/7] net: dsa: add port parsing functions Vivien Didelot
2017-10-27 19:55 ` [PATCH net-next 1/7] net: dsa: get ports within parsing code Vivien Didelot
2017-10-30 18:37 ` Florian Fainelli
2017-10-27 19:55 ` [PATCH net-next 2/7] net: dsa: add port parse functions Vivien Didelot
2017-10-30 18:37 ` Florian Fainelli
2017-10-27 19:55 ` [PATCH net-next 3/7] net: dsa: get port type at parse time Vivien Didelot
2017-10-30 18:39 ` Florian Fainelli [this message]
2017-10-30 18:46 ` Vivien Didelot
2017-10-30 18:46 ` Florian Fainelli
2017-10-27 19:55 ` [PATCH net-next 4/7] net: dsa: check master device before put Vivien Didelot
2017-10-27 19:55 ` [PATCH net-next 5/7] net: dsa: get master device at port parsing time Vivien Didelot
2017-10-30 18:41 ` Florian Fainelli
2017-10-27 19:55 ` [PATCH net-next 6/7] net: dsa: get port name at parse time Vivien Didelot
2017-10-30 18:44 ` Florian Fainelli
2017-10-27 19:55 ` [PATCH net-next 7/7] net: dsa: remove name arg from slave create Vivien Didelot
2017-10-30 18:44 ` Florian Fainelli
2017-11-01 2:48 ` [PATCH net-next 0/7] net: dsa: add port parsing functions David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d45c07a3-940b-e2f3-8011-e44ca074a502@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@savoirfairelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.