netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mark dev_alloc as deprecated.
@ 2003-10-14 18:19 Stephen Hemminger
  2003-10-14 20:16 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2003-10-14 18:19 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

dev_alloc is an older way of getting a network device.  Most uses of it are gone,
and it was usually used in an unsafe way.  The remaining usage in 2.6.0-test7
are in arcnet devices.

diff -urN -X dontdiff linux-2.5/include/linux/netdevice.h linux-2.5-net/include/linux/netdevice.h
--- linux-2.5/include/linux/netdevice.h	2003-10-07 11:28:37.000000000 -0700
+++ linux-2.5-net/include/linux/netdevice.h	2003-10-07 11:59:36.000000000 -0700
@@ -511,7 +511,11 @@
 						    unsigned short mask);
 extern struct net_device	*dev_get_by_name(const char *name);
 extern struct net_device	*__dev_get_by_name(const char *name);
-extern struct net_device	*dev_alloc(const char *name, int *err);
+extern struct net_device        *__dev_alloc(const char *name, int *err);
+static inline __deprecated struct net_device *dev_alloc(const char *name, int *err)
+{
+	return __dev_alloc(name, err);
+}
 extern int		dev_alloc_name(struct net_device *dev, const char *name);
 extern int		dev_open(struct net_device *dev);
 extern int		dev_close(struct net_device *dev);
diff -urN -X dontdiff linux-2.5/net/core/dev.c linux-2.5-net/net/core/dev.c
--- linux-2.5/net/core/dev.c	2003-10-07 11:29:56.000000000 -0700
+++ linux-2.5-net/net/core/dev.c	2003-10-07 16:35:51.000000000 -0700
@@ -646,11 +646,12 @@
  *	failed. The cause of an error is returned as a negative errno code
  *	in the variable @err points to.
  *
- *	The caller must hold the @dev_base or RTNL locks when doing this in
+ *	This call is deprecated in favor of alloc_netdev because
+ *	the caller must hold the @dev_base or RTNL locks when doing this in
  *	order to avoid duplicate name allocations.
  */
 
-struct net_device *dev_alloc(const char *name, int *err)
+struct net_device *__dev_alloc(const char *name, int *err)
 {
 	struct net_device *dev = kmalloc(sizeof(*dev), GFP_KERNEL);
 
@@ -2997,7 +2998,7 @@
 EXPORT_SYMBOL(__skb_linearize);
 EXPORT_SYMBOL(call_netdevice_notifiers);
 EXPORT_SYMBOL(dev_add_pack);
-EXPORT_SYMBOL(dev_alloc);
+EXPORT_SYMBOL(__dev_alloc);
 EXPORT_SYMBOL(dev_alloc_name);
 EXPORT_SYMBOL(dev_close);
 EXPORT_SYMBOL(dev_get_by_flags);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mark dev_alloc as deprecated.
  2003-10-14 18:19 [PATCH] mark dev_alloc as deprecated Stephen Hemminger
@ 2003-10-14 20:16 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2003-10-14 20:16 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

On Tue, 14 Oct 2003 11:19:40 -0700
Stephen Hemminger <shemminger@osdl.org> wrote:

> dev_alloc is an older way of getting a network device.  Most uses of it are gone,
> and it was usually used in an unsafe way.  The remaining usage in 2.6.0-test7
> are in arcnet devices.

Applied, thanks Stephen.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-10-14 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-14 18:19 [PATCH] mark dev_alloc as deprecated Stephen Hemminger
2003-10-14 20:16 ` David S. Miller

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).