/** * rmnet_config_notify_cb() - Callback for netdevice notifier chain * @nb: Notifier block data * @event: Netdevice notifier event ID * @data: Contains a net device for which we are getting notified * * Return: * - result of NOTIFY_DONE() */ int rmnet_config_notify_cb(struct notifier_block *nb, unsigned long event, void *data) { struct net_device *dev = (struct net_device *)data; if (!dev) BUG(); LOGL("(..., %lu, %s)", event, dev->name); switch (event) { case NETDEV_UNREGISTER_FINAL: case NETDEV_UNREGISTER: trace_rmnet_unregister_cb_entry(dev); if (_rmnet_is_physical_endpoint_associated(dev)) { LOGH("Kernel is trying to unregister %s", dev->name); rmnet_force_unassociate_device(dev); } trace_rmnet_unregister_cb_exit(dev); break; default: trace_rmnet_unregister_cb_unhandled(dev); LOGD("Unhandeled event [%lu]", event); break; } return NOTIFY_DONE; }
static int rmnet_config_notify_cb(struct notifier_block *nb, unsigned long event, void *data) { struct net_device *dev = netdev_notifier_info_to_dev(data); if (!dev) return NOTIFY_DONE; switch (event) { case NETDEV_UNREGISTER: netdev_dbg(dev, "Kernel unregister\n"); rmnet_force_unassociate_device(dev); break; default: break; } return NOTIFY_DONE; }