Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1742286
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH net-next 4/8] net: dsa: use temporary dsa_device_ops variable |
| Date | 2017-09-29 20:50 +0200 |
| Message-ID | <uv8wi-1rx-27@gated-at.bofh.it> (permalink) |
| References | <uv8wh-1rx-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
When resolving the DSA tagging protocol used by a CPU switch, use a
temporary "tag_ops" variable to store the dsa_device_ops instead of
using directly dst->tag_ops. This will make the future patches moving
this pointer around easier to read.
There is no functional changes.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
net/dsa/dsa2.c | 8 +++++---
net/dsa/legacy.c | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index dcccaebde708..6a10c5c1639f 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -485,6 +485,7 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
struct dsa_switch_tree *dst,
struct dsa_switch *ds)
{
+ const struct dsa_device_ops *tag_ops;
enum dsa_tag_protocol tag_protocol;
struct net_device *ethernet_dev;
struct device_node *ethernet;
@@ -514,13 +515,14 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
ds->cpu_port_mask |= BIT(index);
tag_protocol = ds->ops->get_tag_protocol(ds);
- dst->tag_ops = dsa_resolve_tag_protocol(tag_protocol);
- if (IS_ERR(dst->tag_ops)) {
+ tag_ops = dsa_resolve_tag_protocol(tag_protocol);
+ if (IS_ERR(tag_ops)) {
dev_warn(ds->dev, "No tagger for this switch\n");
ds->cpu_port_mask &= ~BIT(index);
- return PTR_ERR(dst->tag_ops);
+ return PTR_ERR(tag_ops);
}
+ dst->tag_ops = tag_ops;
dst->rcv = dst->tag_ops->rcv;
return 0;
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index ae505d8e4417..8e849013f69d 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -144,13 +144,15 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
* switch.
*/
if (dst->cpu_dp->ds == ds) {
+ const struct dsa_device_ops *tag_ops;
enum dsa_tag_protocol tag_protocol;
tag_protocol = ops->get_tag_protocol(ds);
- dst->tag_ops = dsa_resolve_tag_protocol(tag_protocol);
- if (IS_ERR(dst->tag_ops))
- return PTR_ERR(dst->tag_ops);
+ tag_ops = dsa_resolve_tag_protocol(tag_protocol);
+ if (IS_ERR(tag_ops))
+ return PTR_ERR(tag_ops);
+ dst->tag_ops = tag_ops;
dst->rcv = dst->tag_ops->rcv;
}
--
2.14.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH net-next 0/8] net: dsa: change dsa_ptr for a dsa_port Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-09-29 20:50 +0200
[PATCH net-next 8/8] net: dsa: remove tag ops from the switch tree Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-09-29 20:50 +0200
[PATCH net-next 4/8] net: dsa: use temporary dsa_device_ops variable Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-09-29 20:50 +0200
Re: [PATCH net-next 4/8] net: dsa: use temporary dsa_device_ops variable Florian Fainelli <f.fainelli@gmail.com> - 2017-09-29 21:20 +0200
Re: [PATCH net-next 0/8] net: dsa: change dsa_ptr for a dsa_port Florian Fainelli <f.fainelli@gmail.com> - 2017-09-29 21:30 +0200
Re: [PATCH net-next 0/8] net: dsa: change dsa_ptr for a dsa_port Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-09-29 21:40 +0200
csiph-web