aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-04-28 11:14:27 -0700
committerDavid S. Miller <davem@davemloft.net>2014-04-30 13:31:25 -0400
commit7fa857ed041537ee6cbc7ee4ab0204a1231cfcb9 (patch)
treeef2b1467a36a089d3961f60f8d445cb6743bde4a /include
parentMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next (diff)
downloadlinux-dev-7fa857ed041537ee6cbc7ee4ab0204a1231cfcb9.tar.xz
linux-dev-7fa857ed041537ee6cbc7ee4ab0204a1231cfcb9.zip
net: dsa: add ds_to_priv
DSA drivers have a trick which consists in allocating "priv_size" more bytes to account for the DSA driver private context. Add a helper function to access that private context instead of open-coding it in drivers with (void *)(ds + 1). Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/dsa.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 7828ebf99ee1..6efce384451e 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -181,6 +181,11 @@ struct dsa_switch_driver {
void register_switch_driver(struct dsa_switch_driver *type);
void unregister_switch_driver(struct dsa_switch_driver *type);
+static inline void *ds_to_priv(struct dsa_switch *ds)
+{
+ return (void *)(ds + 1);
+}
+
/*
* The original DSA tag format and some other tag formats have no
* ethertype, which means that we need to add a little hack to the