Lines Matching refs:wandev
38 * check wandev->setup return value
75 static int wanrouter_device_setup(struct wan_device *wandev,
77 static int wanrouter_device_stat(struct wan_device *wandev,
79 static int wanrouter_device_shutdown(struct wan_device *wandev);
80 static int wanrouter_device_new_if(struct wan_device *wandev,
82 static int wanrouter_device_del_if(struct wan_device *wandev,
90 static int wanrouter_delete_interface(struct wan_device *wandev, char *name);
162 int register_wan_device(struct wan_device *wandev)
166 if ((wandev == NULL) || (wandev->magic != ROUTER_MAGIC) ||
167 (wandev->name == NULL))
170 namelen = strlen(wandev->name);
174 if (wanrouter_find_device(wandev->name))
179 wanrouter_modname, wandev->name);
185 err = wanrouter_proc_add(wandev);
189 wanrouter_modname, wandev->name);
198 wandev->ndev = 0;
199 wandev->dev = NULL;
200 wandev->next = wanrouter_router_devlist;
201 wanrouter_router_devlist = wandev;
220 struct wan_device *wandev, *prev;
225 for (wandev = wanrouter_router_devlist, prev = NULL;
226 wandev && strcmp(wandev->name, name);
227 prev = wandev, wandev = wandev->next)
229 if (wandev == NULL)
237 if (wandev->state != WAN_UNCONFIGURED)
238 wanrouter_device_shutdown(wandev);
241 prev->next = wandev->next;
243 wanrouter_router_devlist = wandev->next;
245 wanrouter_proc_delete(wandev);
261 struct wan_device *wandev;
274 wandev = dent->data;
275 if (wandev->magic != ROUTER_MAGIC)
281 err = wanrouter_device_setup(wandev, data);
285 err = wanrouter_device_shutdown(wandev);
289 err = wanrouter_device_stat(wandev, data);
293 err = wanrouter_device_new_if(wandev, data);
297 err = wanrouter_device_del_if(wandev, data);
306 wandev->ioctl)
307 err = wandev->ioctl(wandev, cmd, arg);
326 static int wanrouter_device_setup(struct wan_device *wandev,
333 if (wandev->setup == NULL) { /* Nothing to do ? */
334 printk(KERN_INFO "%s: ERROR, No setup script: wandev->setup()\n",
335 wandev->name);
342 wandev->name);
348 wandev->name);
356 wandev->name);
364 wandev->name, conf->data_size);
373 wandev->name);
379 err = wandev->setup(wandev, conf);
383 wandev->name);
390 wandev->name, conf->data_size);
403 static int wanrouter_device_shutdown(struct wan_device *wandev)
408 if (wandev->state == WAN_UNCONFIGURED)
411 printk(KERN_INFO "\n%s: Shutting Down!\n",wandev->name);
413 for (dev = wandev->dev; dev;) {
414 err = wanrouter_delete_interface(wandev, dev->name);
419 * as the next element: wandev->dev points to the
421 dev = wandev->dev;
424 if (wandev->ndev)
427 if (wandev->shutdown)
428 err=wandev->shutdown(wandev);
437 static int wanrouter_device_stat(struct wan_device *wandev,
445 if ((wandev->state != WAN_UNCONFIGURED) && wandev->update)
446 wandev->update(wandev);
449 stat.ndev = wandev->ndev;
450 stat.state = wandev->state;
468 static int wanrouter_device_new_if(struct wan_device *wandev,
475 if ((wandev->state == WAN_UNCONFIGURED) || (wandev->new_if == NULL))
492 wandev->name);
496 err = wandev->new_if(wandev, dev, cnf);
519 lock_adapter_irq(&wandev->lock, &smp_flags);
521 if (wandev->dev == NULL) {
522 wandev->dev = dev;
524 for (slave=wandev->dev;
529 ++wandev->ndev;
531 unlock_adapter_irq(&wandev->lock, &smp_flags);
536 if (wandev->del_if)
537 wandev->del_if(wandev, dev);
553 static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_name)
558 if (wandev->state == WAN_UNCONFIGURED)
566 err = wanrouter_delete_interface(wandev, name);
579 if (!wandev->ndev && wandev->shutdown)
580 err = wandev->shutdown(wandev);
596 struct wan_device *wandev;
598 for (wandev = wanrouter_router_devlist;
599 wandev && strcmp(wandev->name, name);
600 wandev = wandev->next);
601 return wandev;
621 static int wanrouter_delete_interface(struct wan_device *wandev, char *name)
626 lock_adapter_irq(&wandev->lock, &smp_flags);
627 dev = wandev->dev;
634 unlock_adapter_irq(&wandev->lock, &smp_flags);
642 if (wandev->del_if)
643 wandev->del_if(wandev, dev);
645 lock_adapter_irq(&wandev->lock, &smp_flags);
653 wandev->dev = *slave;
655 --wandev->ndev;
656 unlock_adapter_irq(&wandev->lock, &smp_flags);
658 printk(KERN_INFO "%s: unregistering '%s'\n", wandev->name, dev->name);