Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e19d8baf authored by Ben Hutchings's avatar Ben Hutchings Committed by John W. Linville
Browse files

ipw2100: Fix order of device registration



Currently cfg80211 fails to create a "phy80211" symlink in sysfs from
the net device to the wiphy device.  The latter needs to be registered
first.

Compile-tested only.

Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b4050790
Loading
Loading
Loading
Loading
+13 −11
Original line number Original line Diff line number Diff line
@@ -1963,10 +1963,8 @@ static int ipw2100_wdev_init(struct net_device *dev)
	wdev->wiphy->n_cipher_suites = ARRAY_SIZE(ipw_cipher_suites);
	wdev->wiphy->n_cipher_suites = ARRAY_SIZE(ipw_cipher_suites);


	set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev);
	set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev);
	if (wiphy_register(wdev->wiphy)) {
	if (wiphy_register(wdev->wiphy))
		ipw2100_down(priv);
		return -EIO;
		return -EIO;
	}
	return 0;
	return 0;
}
}


@@ -6331,6 +6329,11 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
	printk(KERN_INFO DRV_NAME
	printk(KERN_INFO DRV_NAME
	       ": Detected Intel PRO/Wireless 2100 Network Connection\n");
	       ": Detected Intel PRO/Wireless 2100 Network Connection\n");


	err = ipw2100_wdev_init(dev);
	if (err)
		goto fail;
	registered = 1;

	/* Bring up the interface.  Pre 0.46, after we registered the
	/* Bring up the interface.  Pre 0.46, after we registered the
	 * network device we would call ipw2100_up.  This introduced a race
	 * network device we would call ipw2100_up.  This introduced a race
	 * condition with newer hotplug configurations (network was coming
	 * condition with newer hotplug configurations (network was coming
@@ -6347,11 +6350,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
		       "Error calling register_netdev.\n");
		       "Error calling register_netdev.\n");
		goto fail;
		goto fail;
	}
	}
	registered = 1;
	registered = 2;

	err = ipw2100_wdev_init(dev);
	if (err)
		goto fail;


	mutex_lock(&priv->action_mutex);
	mutex_lock(&priv->action_mutex);


@@ -6390,13 +6389,16 @@ out:


      fail_unlock:
      fail_unlock:
	mutex_unlock(&priv->action_mutex);
	mutex_unlock(&priv->action_mutex);
	wiphy_unregister(priv->ieee->wdev.wiphy);
	kfree(priv->ieee->bg_band.channels);
      fail:
      fail:
	if (dev) {
	if (dev) {
		if (registered)
		if (registered >= 2)
			unregister_netdev(dev);
			unregister_netdev(dev);


		if (registered) {
			wiphy_unregister(priv->ieee->wdev.wiphy);
			kfree(priv->ieee->bg_band.channels);
		}

		ipw2100_hw_stop_adapter(priv);
		ipw2100_hw_stop_adapter(priv);


		ipw2100_disable_interrupts(priv);
		ipw2100_disable_interrupts(priv);