summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/Makefile3
-rw-r--r--net/core/dev.c18
2 files changed, 18 insertions, 3 deletions
diff --git a/net/core/Makefile b/net/core/Makefile
index bb81a042bca1..a1a8ff3c2833 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -6,9 +6,10 @@ obj-y := sock.o skbuff.o iovec.o datagram.o scm.o
obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
-obj-y += flow.o dev.o ethtool.o net-sysfs.o dev_mcast.o dst.o \
+obj-y += flow.o dev.o ethtool.o dev_mcast.o dst.o \
neighbour.o rtnetlink.o utils.o link_watch.o filter.o
+obj-$(CONFIG_SYSFS) += net-sysfs.o
obj-$(CONFIG_NETFILTER) += netfilter.o
obj-$(CONFIG_NET_DIVERT) += dv.o
obj-$(CONFIG_NET_PKTGEN) += pktgen.o
diff --git a/net/core/dev.c b/net/core/dev.c
index 4d2817ff9b3c..e77815ed835e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -220,9 +220,15 @@ int netdev_fastroute;
int netdev_fastroute_obstacles;
#endif
+#ifdef CONFIG_SYSFS
extern int netdev_sysfs_init(void);
extern int netdev_register_sysfs(struct net_device *);
-extern int netdev_unregister_sysfs(struct net_device *);
+extern void netdev_unregister_sysfs(struct net_device *);
+#else
+#define netdev_sysfs_init() (0)
+#define netdev_register_sysfs(dev) (0)
+#define netdev_unregister_sysfs(dev) do { } while(0)
+#endif
/*******************************************************************************
@@ -2971,6 +2977,7 @@ static DECLARE_MUTEX(net_todo_run_mutex);
void netdev_run_todo(void)
{
struct list_head list = LIST_HEAD_INIT(list);
+ int err;
/* Safe outside mutex since we only care about entries that
* this cpu put into queue while under RTNL.
@@ -2993,7 +3000,10 @@ void netdev_run_todo(void)
switch(dev->reg_state) {
case NETREG_REGISTERING:
- netdev_register_sysfs(dev);
+ err = netdev_register_sysfs(dev);
+ if (err)
+ printk(KERN_ERR "%s: failed sysfs registration (%d)\n",
+ dev->name, err);
dev->reg_state = NETREG_REGISTERED;
break;
@@ -3037,6 +3047,7 @@ void netdev_run_todo(void)
*/
void free_netdev(struct net_device *dev)
{
+#ifdef CONFIG_SYSFS
/* Compatiablity with error handling in drivers */
if (dev->reg_state == NETREG_UNINITIALIZED) {
kfree((char *)dev - dev->padded);
@@ -3048,6 +3059,9 @@ void free_netdev(struct net_device *dev)
/* will free via class release */
class_device_put(&dev->class_dev);
+#else
+ kfree((char *)dev - dev->padded);
+#endif
}
/* Synchronize with packet receive processing. */