mlxsw: core: Add mlxsw_core_port_driver_priv helper
authorJiri Pirko <jiri@mellanox.com>
Thu, 14 Apr 2016 16:19:23 +0000 (18:19 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 14 Apr 2016 20:22:05 +0000 (16:22 -0400)
Needed in following patch.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core.h

index 184e9853398b08dc97108664d929de2248627a1c..d0c471f26748cd71cea6ae88f373bb57142eb7d2 100644 (file)
@@ -137,6 +137,15 @@ struct mlxsw_core_port {
        struct devlink_port devlink_port;
 };
 
+static inline void *
+mlxsw_core_port_driver_priv(struct mlxsw_core_port *mlxsw_core_port)
+{
+       /* mlxsw_core_port is ensured to always be the first field in driver
+        * port structure.
+        */
+       return mlxsw_core_port;
+}
+
 int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core,
                         struct mlxsw_core_port *mlxsw_core_port, u8 local_port,
                         struct net_device *dev, bool split, u32 split_group);