Commit 7fa857ed authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

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: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ed036f80
...@@ -181,6 +181,11 @@ struct dsa_switch_driver { ...@@ -181,6 +181,11 @@ struct dsa_switch_driver {
void register_switch_driver(struct dsa_switch_driver *type); void register_switch_driver(struct dsa_switch_driver *type);
void unregister_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 * 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 * ethertype, which means that we need to add a little hack to the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment