/* (re-)initialize the data structures for x25iface encapsulation */ static int isdn_x25iface_proto_restart(struct concap_proto *cprot, struct net_device *ndev, struct concap_device_ops *dops) { ix25_pdata_t * pda = cprot -> proto_data ; ulong flags; IX25DEBUG( "isdn_x25iface_proto_restart %s \n", MY_DEVNAME(ndev) ); if ( pdata_is_bad( pda ) ) return -1; if( !( dops && dops -> data_req && dops -> connect_req && dops -> disconn_req ) ){ printk( KERN_WARNING "isdn_x25iface_restart: required dops" " missing\n" ); isdn_x25iface_proto_close(cprot); return -1; } spin_lock_irqsave(&cprot->lock, flags); cprot -> net_dev = ndev; cprot -> pops = &ix25_pops; cprot -> dops = dops; pda -> state = WAN_DISCONNECTED; spin_unlock_irqrestore(&cprot->lock, flags); return 0; }
/* (re-)initialize the data structures for x25iface encapsulation */ int isdn_x25iface_proto_restart(struct concap_proto *cprot, struct net_device *ndev, struct concap_device_ops *dops) { ix25_pdata_t * pda = cprot -> proto_data ; ulong flags; IX25DEBUG( "isdn_x25iface_proto_restart %s \n", MY_DEVNAME(ndev) ); if ( pdata_is_bad( pda ) ) return -1; if( !( dops && dops -> data_req && dops -> connect_req && dops -> disconn_req ) ){ printk( KERN_WARNING "isdn_x25iface_restart: required dops" " missing\n" ); isdn_x25iface_proto_close(cprot); return -1; } save_flags(flags); cli(); /* avoid races with incoming events calling pops methods while cprot members are inconsistent */ cprot -> net_dev = ndev; cprot -> pops = &ix25_pops; cprot -> dops = dops; pda -> state = WAN_DISCONNECTED; restore_flags(flags); return 0; }
/* close the x25iface encapsulation protocol */ int isdn_x25iface_proto_close(struct concap_proto *cprot){ ix25_pdata_t *tmp; int ret = 0; ulong flags; if( ! cprot ){ printk( KERN_ERR "isdn_x25iface_proto_close: " "invalid concap_proto pointer\n" ); return -1; } IX25DEBUG( "isdn_x25iface_proto_close %s \n", MY_DEVNAME(cprot -> net_dev) ); save_flags(flags); cli(); /* avoid races with incoming events calling pops methods while cprot members are inconsistent */ cprot -> dops = NULL; cprot -> net_dev = NULL; tmp = cprot -> proto_data; if( pdata_is_bad( tmp ) ){ ret = -1; } else { tmp -> state = WAN_UNCONFIGURED; } restore_flags(flags); return ret; }
/* close the x25iface encapsulation protocol */ static int isdn_x25iface_proto_close(struct concap_proto *cprot){ ix25_pdata_t *tmp; int ret = 0; ulong flags; if( ! cprot ){ printk( KERN_ERR "isdn_x25iface_proto_close: " "invalid concap_proto pointer\n" ); return -1; } IX25DEBUG( "isdn_x25iface_proto_close %s \n", MY_DEVNAME(cprot -> net_dev) ); spin_lock_irqsave(&cprot->lock, flags); cprot -> dops = NULL; cprot -> net_dev = NULL; tmp = cprot -> proto_data; if( pdata_is_bad( tmp ) ){ ret = -1; } else { tmp -> state = WAN_UNCONFIGURED; } spin_unlock_irqrestore(&cprot->lock, flags); return ret; }