net: cleanup for net/core/dev.c
Subsystems (2)
PATCH 1/1 net: cleanup for net/core/dev.c
net/core/dev.c:netdev_priv() do the same thing like
dev->priv = ((char *)dev +
((sizeof(struct net_device) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST));
Signed-off-by Jianjun Kong <[email protected]>
--- net/core/dev.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
net/core/dev.c +3 -6
@@ -4305,7 +4305,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,size_t alloc_size;void *p; -BUG_ON (strlen (name) >=sizeof (dev->name)); +BUG_ON (strlen (name) >=IFNAMSIZ ); alloc_size =sizeof (struct net_device );if (sizeof_priv) {
@@ -4339,11 +4339,8 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, dev->num_tx_queues = queue_count; dev->real_num_tx_queues = queue_count; -if (sizeof_priv) { - dev->priv = ((char *)dev + - ((sizeof (struct net_device ) +NETDEV_ALIGN_CONST ) - & ~NETDEV_ALIGN_CONST )); - } +if (sizeof_priv) + dev->priv =netdev_priv (dev); dev->gso_max_size =GSO_MAX_SIZE ;
Signature · 6 lines
1.5.6.3 -- Jianjun Kong |Happy Hacking Homepage: http://kongove.cn Gtalk:[email protected]
net/core/dev.c struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, · line 4343
Quoted 7 lines · Jianjun Kong
net/core/dev.c +2
-5-if (sizeof_priv) { - dev->priv = ((char *)dev + - ((sizeof (struct net_device ) +NETDEV_ALIGN_CONST ) - & ~NETDEV_ALIGN_CONST )); - } +if (sizeof_priv) + dev->priv =netdev_priv (dev);
If I understood all of this correctly, ->priv is going away, so there is no point in changing it's initialisation.