public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* missing sysfs device symlink for platform devices
@ 2006-03-11  0:34 Olaf Hering
  2006-04-21 15:40 ` [PATCH] mv643xx_eth: provide sysfs class device symlink Olaf Hering
  0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2006-03-11  0:34 UTC (permalink / raw)
  To: linux-kernel


Why is the /sys/class/net/eth0/device symlink not created for the
mv643xx_eth driver? Does this work for other platform device drivers?
Seems to work for the ps2 keyboard at least.

/sys/class/input/input1/device -> ../../../devices/platform/i8042/serio1


Index: linux-2.6.16-rc5-olh/drivers/net/mv643xx_eth.c
===================================================================
--- linux-2.6.16-rc5-olh.orig/drivers/net/mv643xx_eth.c
+++ linux-2.6.16-rc5-olh/drivers/net/mv643xx_eth.c
@@ -1449,6 +1452,7 @@ static int mv643xx_eth_probe(struct plat
        if (err)
                goto out;

+       SET_NETDEV_DEV(dev, &pdev->dev);
        p = dev->dev_addr;
        printk(KERN_NOTICE
                "%s: port %d with MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",


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

* [PATCH] mv643xx_eth: provide sysfs class device symlink
  2006-03-11  0:34 missing sysfs device symlink for platform devices Olaf Hering
@ 2006-04-21 15:40 ` Olaf Hering
  0 siblings, 0 replies; 2+ messages in thread
From: Olaf Hering @ 2006-04-21 15:40 UTC (permalink / raw)
  To: linux-kernel, Dale Farnsworth

 On Sat, Mar 11, Olaf Hering wrote:

> Why is the /sys/class/net/eth0/device symlink not created for the
> mv643xx_eth driver? Does this work for other platform device drivers?
> Seems to work for the ps2 keyboard at least.

The SET_NETDEV_DEV has to be done before a call to register_netdev. With
the new patch below, the device symlink for the platform device was created.
Unfortunately, after the 4 ls commands, the network connection died. No
idea if the box crashed or if something else broke, lost remote access.



Provide sysfs 'device' in /class/net/ethN
Also, set module owner field, like pcnet32 driver does.

Signed-off-by: Olaf Hering <olh@suse.de>

---
 drivers/net/mv643xx_eth.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6.17-rc2/drivers/net/mv643xx_eth.c
===================================================================
--- linux-2.6.17-rc2.orig/drivers/net/mv643xx_eth.c
+++ linux-2.6.17-rc2/drivers/net/mv643xx_eth.c
@@ -1419,6 +1419,8 @@ static int mv643xx_eth_probe(struct plat
 	mv643xx_eth_update_pscr(dev, &cmd);
 	mv643xx_set_settings(dev, &cmd);
 
+	SET_MODULE_OWNER(dev);
+	SET_NETDEV_DEV(dev, &pdev->dev);
 	err = register_netdev(dev);
 	if (err)
 		goto out;




-- 

olaf@cantaloupe:~> l /sys/class/net/
total 0
drwxr-xr-x 3 root root 0 2006-04-21 17:14 eth0/
drwxr-xr-x 3 root root 0 2006-04-21 17:14 eth1/
drwxr-xr-x 3 root root 0 2006-04-21 17:14 lo/
drwxr-xr-x 3 root root 0 2006-04-21 17:15 sit0/
olaf@cantaloupe:~> l /sys/class/net/eth0/
total 0
-r--r--r-- 1 root root 4096 2006-04-21 17:14 addr_len
-r--r--r-- 1 root root 4096 2006-04-21 17:14 address
-r--r--r-- 1 root root 4096 2006-04-21 17:14 broadcast
-r--r--r-- 1 root root 4096 2006-04-21 17:14 carrier
lrwxrwxrwx 1 root root    0 2006-04-21 17:14 device -> ../../../devices/platform/mv643xx_eth.1/
-r--r--r-- 1 root root 4096 2006-04-21 17:14 features
-rw-r--r-- 1 root root 4096 2006-04-21 17:14 flags
-r--r--r-- 1 root root 4096 2006-04-21 17:14 ifindex
-r--r--r-- 1 root root 4096 2006-04-21 17:14 iflink
-rw-r--r-- 1 root root 4096 2006-04-21 17:14 mtu
drwxr-xr-x 2 root root    0 2006-04-21 17:14 statistics/
-rw-r--r-- 1 root root 4096 2006-04-21 17:14 tx_queue_len
-r--r--r-- 1 root root 4096 2006-04-21 17:14 type
--w------- 1 root root 4096 2006-04-21 17:14 uevent
-rw-r--r-- 1 root root 4096 2006-04-21 17:14 weight
olaf@cantaloupe:~> l /sys/class/net/eth1/
total 0
-r--r--r-- 1 root root 4096 2006-04-21 17:14 addr_len
-r--r--r-- 1 root root 4096 2006-04-21 17:14 address
-r--r--r-- 1 root root 4096 2006-04-21 17:14 broadcast
-r--r--r-- 1 root root 4096 2006-04-21 17:14 carrier
lrwxrwxrwx 1 root root    0 2006-04-21 17:14 device -> ../../../devices/pci0000:00/0000:00:0d.0/
-r--r--r-- 1 root root 4096 2006-04-21 17:14 features
-rw-r--r-- 1 root root 4096 2006-04-21 17:14 flags
-r--r--r-- 1 root root 4096 2006-04-21 17:14 ifindex
-r--r--r-- 1 root root 4096 2006-04-21 17:14 iflink
-rw-r--r-- 1 root root 4096 2006-04-21 17:14 mtu
drwxr-xr-x 2 root root    0 2006-04-21 17:14 statistics/
-rw-r--r-- 1 root root 4096 2006-04-21 17:14 tx_queue_len
-r--r--r-- 1 root root 4096 2006-04-21 17:14 type
--w------- 1 root root 4096 2006-04-21 17:14 uevent
-rw-r--r-- 1 root root 4096 2006-04-21 17:14 weight
olaf@cantaloupe:~> l /sys/class/net/eth*/device
lrwxrwxrwx 1 root root 0 2006-04-21 17:14 /sys/class/net/eth0/device -> ../../../devices/platform/mv643xx_eth.1/
lrwxrwxrwx 1 root root 0 2006-04-21 17:14 /sys/class/net/eth1/device -> ../../../devices/pci0000:00/0000:00:0d.0/
olaf@cantaloupe:~> 





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

end of thread, other threads:[~2006-04-21 15:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-11  0:34 missing sysfs device symlink for platform devices Olaf Hering
2006-04-21 15:40 ` [PATCH] mv643xx_eth: provide sysfs class device symlink Olaf Hering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox