* [PATCH] net: cleanup for net/core/dev.c
@ 2008-12-08 14:52 Jianjun Kong
2008-12-08 15:32 ` Alexey Dobriyan
0 siblings, 1 reply; 2+ messages in thread
From: Jianjun Kong @ 2008-12-08 14:52 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
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 <jianjun@zeuux.org>
---
net/core/dev.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 9174c77..f6d9af5 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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;
--
1.5.6.3
--
Jianjun Kong |Happy Hacking
Homepage: http://kongove.cn
Gtalk:kongjianjun@gmail.com
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: cleanup for net/core/dev.c
2008-12-08 14:52 [PATCH] net: cleanup for net/core/dev.c Jianjun Kong
@ 2008-12-08 15:32 ` Alexey Dobriyan
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Dobriyan @ 2008-12-08 15:32 UTC (permalink / raw)
To: Jianjun Kong; +Cc: David S. Miller, netdev
On Mon, Dec 08, 2008 at 10:52:14PM +0800, Jianjun Kong wrote:
> - 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-08 15:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-08 14:52 [PATCH] net: cleanup for net/core/dev.c Jianjun Kong
2008-12-08 15:32 ` Alexey Dobriyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).