diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-05-27 04:42:37 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-27 15:47:06 -0700 |
commit | 1ce8e7b57b3a4527ef83da1c5c7bd8a6b9d87b56 (patch) | |
tree | 095536a47e40fdb621c1f959637fa63f57a4ccf2 /net/core | |
parent | 0bb32417ff0f6ac385e4eec3ef6641950bbb3694 (diff) | |
download | kernel_samsung_crespo-1ce8e7b57b3a4527ef83da1c5c7bd8a6b9d87b56.zip kernel_samsung_crespo-1ce8e7b57b3a4527ef83da1c5c7bd8a6b9d87b56.tar.gz kernel_samsung_crespo-1ce8e7b57b3a4527ef83da1c5c7bd8a6b9d87b56.tar.bz2 |
net: ALIGN/PTR_ALIGN cleanup in alloc_netdev_mq()/netdev_priv()
Use ALIGN() and PTR_ALIGN() macros instead of handcoding them.
Get rid of NETDEV_ALIGN_CONST ugly define
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index ed4550f..32ceee1 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4988,18 +4988,18 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, struct netdev_queue *tx; struct net_device *dev; size_t alloc_size; - void *p; + struct net_device *p; BUG_ON(strlen(name) >= sizeof(dev->name)); alloc_size = sizeof(struct net_device); if (sizeof_priv) { /* ensure 32-byte alignment of private area */ - alloc_size = (alloc_size + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST; + alloc_size = ALIGN(alloc_size, NETDEV_ALIGN); alloc_size += sizeof_priv; } /* ensure 32-byte alignment of whole construct */ - alloc_size += NETDEV_ALIGN_CONST; + alloc_size += NETDEV_ALIGN - 1; p = kzalloc(alloc_size, GFP_KERNEL); if (!p) { @@ -5014,8 +5014,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, goto free_p; } - dev = (struct net_device *) - (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); + dev = PTR_ALIGN(p, NETDEV_ALIGN); dev->padded = (char *)dev - (char *)p; if (dev_addr_init(dev)) |