From: Gerd Knorr <kraxel@bytesex.org>
To: Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
uml devel <user-mode-linux-devel@lists.sourceforge.net>,
Jeff Dike <jdike@addtoit.com>,
Blaisorblade <blaisorblade_spam@yahoo.it>
Subject: [uml-devel] [patch] uml: sysfs support for uml network driver.
Date: Tue, 7 Dec 2004 15:38:53 +0100 [thread overview]
Message-ID: <20041207143852.GA23644@bytesex> (raw)
Add sysfs support to the uml network driver. Also comment
the eth_init function, I think that one is never ever needed
as the devices are initialized when the underlying transport
mechanism registeres.
Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
---
arch/um/drivers/net_kern.c | 24 ++++++++++++++++++++++--
arch/um/include/net_kern.h | 1 +
2 files changed, 23 insertions(+), 2 deletions(-)
Index: linux-2.6.10-rc3/arch/um/include/net_kern.h
===================================================================
--- linux-2.6.10-rc3.orig/arch/um/include/net_kern.h 2004-12-07 12:12:18.000000000 +0100
+++ linux-2.6.10-rc3/arch/um/include/net_kern.h 2004-12-07 13:11:07.059493999 +0100
@@ -14,6 +14,7 @@
struct uml_net {
struct list_head list;
struct net_device *dev;
+ struct platform_device pdev;
int index;
unsigned char mac[ETH_ALEN];
int have_mac;
Index: linux-2.6.10-rc3/arch/um/drivers/net_kern.c
===================================================================
--- linux-2.6.10-rc3.orig/arch/um/drivers/net_kern.c 2004-12-07 12:11:53.000000000 +0100
+++ linux-2.6.10-rc3/arch/um/drivers/net_kern.c 2004-12-07 14:23:20.664164072 +0100
@@ -30,6 +30,8 @@
#include "irq_user.h"
#include "irq_kern.h"
+#define DRIVER_NAME "uml-netdev"
+
static spinlock_t opened_lock = SPIN_LOCK_UNLOCKED;
LIST_HEAD(opened);
@@ -252,7 +254,7 @@ static int uml_net_ioctl(struct net_devi
{
static const struct ethtool_drvinfo info = {
.cmd = ETHTOOL_GDRVINFO,
- .driver = "uml virtual ethernet",
+ .driver = DRIVER_NAME,
.version = "42",
};
void *useraddr;
@@ -289,6 +291,12 @@ void uml_net_user_timer_expire(unsigned
static spinlock_t devices_lock = SPIN_LOCK_UNLOCKED;
static struct list_head devices = LIST_HEAD_INIT(devices);
+static struct device_driver uml_net_driver = {
+ .name = DRIVER_NAME,
+ .bus = &platform_bus_type,
+};
+static int driver_registered;
+
static int eth_configure(int n, void *init, char *mac,
struct transport *transport)
{
@@ -330,6 +338,16 @@ static int eth_configure(int n, void *in
return 1;
}
+ /* sysfs register */
+ if (!driver_registered) {
+ driver_register(¨_net_driver);
+ driver_registered = 1;
+ }
+ device->pdev.id = n;
+ device->pdev.name = DRIVER_NAME;
+ platform_device_register(&device->pdev);
+ SET_NETDEV_DEV(dev,&device->pdev.dev);
+
/* If this name ends up conflicting with an existing registered
* netdevice, that is OK, register_netdev{,ice}() will notice this
* and fail.
@@ -560,6 +578,7 @@ __uml_help(eth_setup,
" Configure a network device.\n\n"
);
+#if 0
static int eth_init(void)
{
struct list_head *ele, *next;
@@ -574,8 +593,8 @@ static int eth_init(void)
return(1);
}
-
__initcall(eth_init);
+#endif
static int net_config(char *str)
{
@@ -616,6 +635,7 @@ static int net_remove(char *str)
if(lp->fd > 0) return(-1);
if(lp->remove != NULL) (*lp->remove)(&lp->user);
unregister_netdev(dev);
+ platform_device_unregister(&device->pdev);
list_del(&device->list);
kfree(device);
--
#define printk(args...) fprintf(stderr, ## args)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
WARNING: multiple messages have this Message-ID (diff)
From: Gerd Knorr <kraxel@bytesex.org>
To: Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
uml devel <user-mode-linux-devel@lists.sourceforge.net>,
Jeff Dike <jdike@addtoit.com>,
Blaisorblade <blaisorblade_spam@yahoo.it>
Subject: [patch] uml: sysfs support for uml network driver.
Date: Tue, 7 Dec 2004 15:38:53 +0100 [thread overview]
Message-ID: <20041207143852.GA23644@bytesex> (raw)
Add sysfs support to the uml network driver. Also comment
the eth_init function, I think that one is never ever needed
as the devices are initialized when the underlying transport
mechanism registeres.
Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
---
arch/um/drivers/net_kern.c | 24 ++++++++++++++++++++++--
arch/um/include/net_kern.h | 1 +
2 files changed, 23 insertions(+), 2 deletions(-)
Index: linux-2.6.10-rc3/arch/um/include/net_kern.h
===================================================================
--- linux-2.6.10-rc3.orig/arch/um/include/net_kern.h 2004-12-07 12:12:18.000000000 +0100
+++ linux-2.6.10-rc3/arch/um/include/net_kern.h 2004-12-07 13:11:07.059493999 +0100
@@ -14,6 +14,7 @@
struct uml_net {
struct list_head list;
struct net_device *dev;
+ struct platform_device pdev;
int index;
unsigned char mac[ETH_ALEN];
int have_mac;
Index: linux-2.6.10-rc3/arch/um/drivers/net_kern.c
===================================================================
--- linux-2.6.10-rc3.orig/arch/um/drivers/net_kern.c 2004-12-07 12:11:53.000000000 +0100
+++ linux-2.6.10-rc3/arch/um/drivers/net_kern.c 2004-12-07 14:23:20.664164072 +0100
@@ -30,6 +30,8 @@
#include "irq_user.h"
#include "irq_kern.h"
+#define DRIVER_NAME "uml-netdev"
+
static spinlock_t opened_lock = SPIN_LOCK_UNLOCKED;
LIST_HEAD(opened);
@@ -252,7 +254,7 @@ static int uml_net_ioctl(struct net_devi
{
static const struct ethtool_drvinfo info = {
.cmd = ETHTOOL_GDRVINFO,
- .driver = "uml virtual ethernet",
+ .driver = DRIVER_NAME,
.version = "42",
};
void *useraddr;
@@ -289,6 +291,12 @@ void uml_net_user_timer_expire(unsigned
static spinlock_t devices_lock = SPIN_LOCK_UNLOCKED;
static struct list_head devices = LIST_HEAD_INIT(devices);
+static struct device_driver uml_net_driver = {
+ .name = DRIVER_NAME,
+ .bus = &platform_bus_type,
+};
+static int driver_registered;
+
static int eth_configure(int n, void *init, char *mac,
struct transport *transport)
{
@@ -330,6 +338,16 @@ static int eth_configure(int n, void *in
return 1;
}
+ /* sysfs register */
+ if (!driver_registered) {
+ driver_register(¨_net_driver);
+ driver_registered = 1;
+ }
+ device->pdev.id = n;
+ device->pdev.name = DRIVER_NAME;
+ platform_device_register(&device->pdev);
+ SET_NETDEV_DEV(dev,&device->pdev.dev);
+
/* If this name ends up conflicting with an existing registered
* netdevice, that is OK, register_netdev{,ice}() will notice this
* and fail.
@@ -560,6 +578,7 @@ __uml_help(eth_setup,
" Configure a network device.\n\n"
);
+#if 0
static int eth_init(void)
{
struct list_head *ele, *next;
@@ -574,8 +593,8 @@ static int eth_init(void)
return(1);
}
-
__initcall(eth_init);
+#endif
static int net_config(char *str)
{
@@ -616,6 +635,7 @@ static int net_remove(char *str)
if(lp->fd > 0) return(-1);
if(lp->remove != NULL) (*lp->remove)(&lp->user);
unregister_netdev(dev);
+ platform_device_unregister(&device->pdev);
list_del(&device->list);
kfree(device);
--
#define printk(args...) fprintf(stderr, ## args)
next reply other threads:[~2004-12-07 15:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-07 14:38 Gerd Knorr [this message]
2004-12-07 14:38 ` [patch] uml: sysfs support for uml network driver Gerd Knorr
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=20041207143852.GA23644@bytesex \
--to=kraxel@bytesex.org \
--cc=akpm@osdl.org \
--cc=blaisorblade_spam@yahoo.it \
--cc=jdike@addtoit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.