Commit 50f7f68f authored by Stephen Hemminger's avatar Stephen Hemminger

[PATCH] (4/4) dlci netdevice event handling

Since dlci device is a pseudo device built on top of sdla, change it to
handle unregister events and delete itself.
parent efb377f6
......@@ -509,20 +509,46 @@ static void dlci_setup(struct net_device *dev)
}
int __init init_dlci(void)
/* if slave is unregistering, then cleanup master */
static int dlci_dev_event(struct notifier_block *unused,
unsigned long event, void *ptr)
{
struct net_device *dev = (struct net_device *) ptr;
if (event == NETDEV_UNREGISTER) {
struct dlci_local *dlp;
list_for_each_entry(dlp, &dlci_devs, list) {
if (dlp->slave == dev) {
unregister_netdevice(dlp->master);
dev_put(dlp->slave);
break;
}
}
}
return NOTIFY_DONE;
}
static struct notifier_block dlci_notifier = {
.notifier_call = dlci_dev_event,
};
static int __init init_dlci(void)
{
dlci_ioctl_set(dlci_ioctl);
register_netdevice_notifier(&dlci_notifier);
printk("%s.\n", version);
return 0;
}
void __exit dlci_exit(void)
static void __exit dlci_exit(void)
{
struct dlci_local *dlp, *nxt;
dlci_ioctl_set(NULL);
unregister_netdevice_notifier(&dlci_notifier);
rtnl_lock();
list_for_each_entry_safe(dlp, nxt, &dlci_devs, list) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment