]> err.no Git - linux-2.6/commitdiff
[PATCH] hostap update
authorDave Hansen <haveblue@us.ibm.com>
Sat, 30 Jul 2005 19:49:58 +0000 (12:49 -0700)
committerJeff Garzik <jgarzik@pobox.com>
Sat, 30 Jul 2005 22:17:22 +0000 (18:17 -0400)
Create sysfs "device" files for hostap

I was writing some scripts to automatically build kismet source lines,
and I noticed that hostap devices don't have device files, unlike my
prism54 and ipw2200 cards:

$ ls -l /sys/class/net/eth0/device
/sys/class/net/eth0/device -> ../../../devices/pci0000:00/0000:00:1e.0/0000:02:01.0
$ ls -l /sys/class/net/wifi0
ls: /sys/class/net/wifi0/device: No such file or directory
$ ls -l /sys/class/net/wlan0
ls: /sys/class/net/wlan0/device: No such file or directory

The following (quite small) patch makes sure that both the wlan and wifi
net devices have that pointer to the bus device.

This way, I can do things like

        for i in /sys/class/net/*; do
                if ! [ -e $i/device/drive ]; then
                        continue;
                fi;
                driver=$(basename $(readlink $i/device/driver))
                case $driver in
                        hostap*)
                                echo -- hostap,$i,$i-$driver
                                break;
                        ipw2?00)
                                echo -- $driver,$i,$i-$driver
                                break;
                        prism54)
                                echo prism54g,$i
                esac
        done

Which should generate a working set of source lines for kismet no matter
what order I plug the cards in.

It might also be handy to have a link between the two net devices, but
that's a patch for another day.

That patch is against 2.6.13-rc1-mm1.

-- Dave

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/net/wireless/hostap/hostap.c
drivers/net/wireless/hostap/hostap_cs.c
drivers/net/wireless/hostap/hostap_hw.c
drivers/net/wireless/hostap/hostap_pci.c
drivers/net/wireless/hostap/hostap_plx.c

index 366cefbaca5918170221efcbfdaef43a81e99f71..ea30ba8060506c505b564df6332e62f1911983be 100644 (file)
@@ -137,6 +137,7 @@ struct net_device * hostap_add_interface(struct local_info *local,
        if (strchr(dev->name, '%'))
                ret = dev_alloc_name(dev, dev->name);
 
+       SET_NETDEV_DEV(dev, mdev->class_dev.dev);
        if (ret >= 0)
                ret = register_netdevice(dev);
 
index f915f0c75cf467e711fcda62b69ef5ba857960f0..649502488d541c37475a236db77ac9c909234036 100644 (file)
@@ -725,7 +725,8 @@ static int prism2_config(dev_link_t *link)
        }
 
        /* Need to allocate net_device before requesting IRQ handler */
-       dev = prism2_init_local_data(&prism2_pccard_funcs, 0);
+       dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
+                                    &handle_to_dev(link->handle));
        if (dev == NULL)
                goto failed;
        link->priv = dev;
index 039ef7f61beec4ad4def2fc8c8e177b559cb62bb..7572050db32da0970122733036b6d70b88fdbcd2 100644 (file)
@@ -3268,7 +3268,8 @@ static void prism2_clear_set_tim_queue(local_info_t *local)
 
 
 static struct net_device *
-prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx)
+prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
+                      struct device *sdev)
 {
        struct net_device *dev;
        struct hostap_interface *iface;
@@ -3439,6 +3440,7 @@ while (0)
 
        rtnl_lock();
        ret = dev_alloc_name(dev, "wifi%d");
+       SET_NETDEV_DEV(dev, sdev);
        if (ret >= 0)
                ret = register_netdevice(dev);
        rtnl_unlock();
index 3a208989333ea09e17cab3a3ef1bb4c5d0d1b7e3..c4c7b2f2e8acad861b70841d087a174cb278770f 100644 (file)
@@ -308,7 +308,8 @@ static int prism2_pci_probe(struct pci_dev *pdev,
        pci_set_master(pdev);
 #endif /* PRISM2_BUS_MASTER */
 
-       dev = prism2_init_local_data(&prism2_pci_funcs, cards_found);
+       dev = prism2_init_local_data(&prism2_pci_funcs, cards_found,
+                                    &pdev->dev);
        if (dev == NULL)
                goto fail;
        iface = netdev_priv(dev);
index ec33501e094a9f65752634e28c53f78dd5f1f0f7..e29ac2271bd2aeea373b5de5cf78300b781ad8a0 100644 (file)
@@ -522,7 +522,8 @@ static int prism2_plx_probe(struct pci_dev *pdev,
                 * not present; but are there really such cards in use(?) */
        }
 
-       dev = prism2_init_local_data(&prism2_plx_funcs, cards_found);
+       dev = prism2_init_local_data(&prism2_plx_funcs, cards_found,
+                                    &pdev->dev);
        if (dev == NULL)
                goto fail;
        iface = netdev_priv(dev);