From: David Gibson <david@gibson.dropbear.id.au>
To: linuxppc-embedded@lists.linuxppc.org
Subject: Init code for ppc405 enet
Date: Thu, 6 Sep 2001 15:19:23 +1000 [thread overview]
Message-ID: <20010906151923.F20279@zax> (raw)
The following patch adds module init code to the ppc405 enet driver,
so that it no longer needs additions to Space.c to be initialised.
diff -urN ../linuxppc_2_4_devel/drivers/net/ppc405_enet.c linux-bungo/drivers/net/ppc405_enet.c
--- ../linuxppc_2_4_devel/drivers/net/ppc405_enet.c Tue Aug 28 15:06:46 2001
+++ linux-bungo/drivers/net/ppc405_enet.c Thu Sep 6 11:50:16 2001
@@ -31,6 +31,7 @@
*/
#include <linux/module.h>
+#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
@@ -54,7 +55,6 @@
#include "ppc405_enet.h"
-int ppc405_enet_probe(struct net_device *);
static int ppc405_enet_probe1(struct net_device *);
static int ppc405_phy_speed(void);
static int ppc405_phy_duplex(void);
@@ -95,27 +95,7 @@
static volatile int ppc405_enet_ack_slot = 0;
static volatile int ppc405_enet_rx_slot = 0;
-
-/*
- * Maintain the initial probe as a sub function just in case it is wished
- * to have this driver as a module later.
- */
-int ppc405_enet_probe_done = 0;
-
-
-
-int
-ppc405_enet_probe(struct net_device *dev)
-{
- if (ppc405_enet_probe_done)
- return -ENODEV;
-
- ppc405_enet_probe1(dev);
-
- ppc405_enet_probe_done = 1;
- return 0;
-}
-
+static struct net_device ppc405_enet_dev;
static int
ppc405_enet_open(struct net_device *dev)
@@ -1265,6 +1245,28 @@
return crc_value;
}
+static int __init init_ppc405_enet(void)
+{
+ int rc;
+
+ rc = ppc405_enet_probe1(&ppc405_enet_dev);
+ if (rc)
+ return rc;
+
+ rc = register_netdev(&ppc405_enet_dev);
+ if (rc)
+ return rc;
+
+ return 0;
+}
+
+static void __exit exit_ppc405_enet(void)
+{
+ unregister_netdev(&ppc405_enet_dev);
+}
+
+module_init(init_ppc405_enet);
+module_exit(exit_ppc405_enet);
/*
* Local variables:
--
David Gibson | For every complex problem there is a
david@gibson.dropbear.id.au | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
reply other threads:[~2001-09-06 5:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20010906151923.F20279@zax \
--to=david@gibson.dropbear.id.au \
--cc=linuxppc-embedded@lists.linuxppc.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).