From: Jianjun Kong <jianjun@zeuux.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>
Subject: [PATCH] net: cleanup for net/core/dev.c
Date: Mon, 8 Dec 2008 22:52:14 +0800 [thread overview]
Message-ID: <20081208145214.GA6830@ubuntu> (raw)
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
next reply other threads:[~2008-12-08 14:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-08 14:52 Jianjun Kong [this message]
2008-12-08 15:32 ` [PATCH] net: cleanup for net/core/dev.c Alexey Dobriyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081208145214.GA6830@ubuntu \
--to=jianjun@zeuux.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).