Skip to content

Commit

Permalink
net: dsa: add ds_to_priv
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Apr 30, 2014
1 parent ed036f8 commit 7fa857e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/net/dsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7fa857e

Please sign in to comment.