@@ -46,14 +46,6 @@ static void devm_netdev_release(struct device *dev, void *this)
unregister_netdev(res->ndev);
}
-static int netdev_devres_match(struct device *dev, void *this, void *match_data)
-{
- struct net_device_devres *res = this;
- struct net_device *ndev = match_data;
-
- return ndev == res->ndev;
-}
-
/**
* devm_register_netdev - resource managed variant of register_netdev()
* @dev: managing device for this netdev - usually the parent device
@@ -61,22 +53,13 @@ static int netdev_devres_match(struct device *dev, void *this, void *match_data)
*
* This is a devres variant of register_netdev() for which the unregister
* function will be call automatically when the managing device is
- * detached. Note: the net_device used must also be resource managed by
- * the same struct device.
+ * detached.
*/
int devm_register_netdev(struct device *dev, struct net_device *ndev)
{
struct net_device_devres *dr;
int ret;
- /* struct net_device must itself be managed. For now a managed netdev
- * can only be allocated by devm_alloc_etherdev_mqs() so the check is
- * straightforward.
- */
- if (WARN_ON(!devres_find(dev, devm_free_netdev,
- netdev_devres_match, ndev)))
- return -EINVAL;
-
dr = devres_alloc(devm_netdev_release, sizeof(*dr), GFP_KERNEL);
if (!dr)
return -ENOMEM;