From: Jeff Garzik <jeff@garzik.org>
To: Yoann Padioleau <padator@wanadoo.fr>
Cc: kernel-janitors@vger.kernel.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dev->priv to netdev_priv(dev), drivers/net/tokenring/
Date: Mon, 30 Jul 2007 16:03:01 -0400 [thread overview]
Message-ID: <46AE43F5.8070802@garzik.org> (raw)
In-Reply-To: <87r6mzmf6q.fsf@wanadoo.fr>
Yoann Padioleau wrote:
> Replacing accesses to dev->priv to netdev_priv(dev). The replacment
> is safe when netdev_priv is used to access a private structure that is
> right next to the net_device structure in memory.
> Cf http://groups.google.com/group/comp.os.linux.development.system/browse_thread/thread/de19321bcd94dbb8/0d74a4adcd6177bd
> This is the case when the net_device structure was allocated with
> a call to alloc_netdev or one of its derivative.
>
> Here is an excerpt of the semantic patch that performs the transformation
>
> @ rule1 @
> type T;
> struct net_device *dev;
> @@
>
> dev =
> (
> alloc_netdev
> |
> alloc_etherdev
> |
> alloc_trdev
> )
> (sizeof(T), ...)
>
> @ rule1bis @
> struct net_device *dev;
> expression E;
> @@
> dev->priv = E
>
> @ rule2 depends on rule1 && !rule1bis @
> struct net_device *dev;
> type rule1.T;
> @@
>
> - (T*) dev->priv
> + netdev_priv(dev)
>
>
> PS: I have performed the same transformation on the whole kernel
> and it affects around 70 files, most of them in drivers/net/.
> Should I split my patch for each subnet directories ? (wireless/, wan/, etc)
applied. splitting up by sub-directory would be helpful.
next prev parent reply other threads:[~2007-07-30 20:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 13:18 [PATCH] dev->priv to netdev_priv(dev), drivers/net/tokenring/ Yoann Padioleau
2007-07-23 15:13 ` Jan Engelhardt
2007-07-23 15:38 ` Yoann Padioleau
2007-07-30 20:03 ` Jeff Garzik [this message]
2007-08-03 18:03 ` dev->priv to netdev_priv(dev) Yoann Padioleau
2007-08-03 23:42 ` Krzysztof Halasa
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=46AE43F5.8070802@garzik.org \
--to=jeff@garzik.org \
--cc=akpm@linux-foundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=padator@wanadoo.fr \
/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