diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1995-11-14 08:00:00 +0000 |
---|---|---|
committer | <ralf@linux-mips.org> | 1995-11-14 08:00:00 +0000 |
commit | e7c2a72e2680827d6a733931273a93461c0d8d1b (patch) | |
tree | c9abeda78ef7504062bb2e816bcf3e3c9d680112 /drivers/net/dummy.c | |
parent | ec6044459060a8c9ce7f64405c465d141898548c (diff) |
Import of Linux/MIPS 1.3.0
Diffstat (limited to 'drivers/net/dummy.c')
-rw-r--r-- | drivers/net/dummy.c | 72 |
1 files changed, 69 insertions, 3 deletions
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index c70629d73..24c410297 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -31,7 +31,11 @@ /* To have statistics (just packets sent) define this */ #undef DUMMY_STATS -#include <linux/config.h> +#ifdef MODULE +#include <linux/module.h> +#include <linux/version.h> +#endif + #include <linux/kernel.h> #include <linux/sched.h> #include <linux/types.h> @@ -57,8 +61,23 @@ static int dummy_xmit(struct sk_buff *skb, struct device *dev); static struct enet_statistics *dummy_get_stats(struct device *dev); #endif -int -dummy_init(struct device *dev) +#ifdef MODULE +static int dummy_open(struct device *dev) +{ + MOD_INC_USE_COUNT; + return 0; +} + +static int dummy_close(struct device *dev) +{ + MOD_DEC_USE_COUNT; + return 0; +} + +#endif + + +int dummy_init(struct device *dev) { /* I commented this out as bootup is noisy enough anyway and this driver seems pretty reliable 8) 8) 8) */ @@ -72,9 +91,14 @@ dummy_init(struct device *dev) memset(dev->priv, 0, sizeof(struct enet_statistics)); dev->get_stats = dummy_get_stats; #endif +#ifdef MODULE + dev->open = &dummy_open; + dev->stop = &dummy_close; +#endif /* Fill in the fields of the device structure with ethernet-generic values. */ ether_setup(dev); + dev->flags |= IFF_NOARP; return 0; } @@ -107,3 +131,45 @@ dummy_get_stats(struct device *dev) return stats; } #endif + +#ifdef MODULE +char kernel_version[] = UTS_RELEASE; + +static int dummy_probe(struct device *dev) +{ + dummy_init(dev); + return 0; +} + +static struct device dev_dummy = { + "dummy0\0 ", + 0, 0, 0, 0, + 0x0, 0, + 0, 0, 0, NULL, dummy_probe }; + +int init_module(void) +{ + /* Find a name for this unit */ + int ct= 1; + + while(dev_get(dev_dummy.name)!=NULL && ct<100) + { + sprintf(dev_dummy.name,"dummy%d",ct); + ct++; + } + + if (register_netdev(&dev_dummy) != 0) + return -EIO; + return 0; +} + +void cleanup_module(void) +{ + if (MOD_IN_USE) + printk("dummy: device busy, remove delayed\n"); + else + { + unregister_netdev(&dev_dummy); + } +} +#endif /* MODULE */ |