aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/drivers/net_kern.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 8ebb2241ad42..8c7279bb353b 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -131,9 +131,8 @@ static int uml_net_open(struct net_device *dev)
131 SA_INTERRUPT | SA_SHIRQ, dev->name, dev); 131 SA_INTERRUPT | SA_SHIRQ, dev->name, dev);
132 if(err != 0){ 132 if(err != 0){
133 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); 133 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err);
134 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
135 lp->fd = -1;
136 err = -ENETUNREACH; 134 err = -ENETUNREACH;
135 goto out_close;
137 } 136 }
138 137
139 lp->tl.data = (unsigned long) &lp->user; 138 lp->tl.data = (unsigned long) &lp->user;
@@ -145,9 +144,19 @@ static int uml_net_open(struct net_device *dev)
145 */ 144 */
146 while((err = uml_net_rx(dev)) > 0) ; 145 while((err = uml_net_rx(dev)) > 0) ;
147 146
148 out:
149 spin_unlock(&lp->lock); 147 spin_unlock(&lp->lock);
150 return(err); 148
149 spin_lock(&opened_lock);
150 list_add(&lp->list, &opened);
151 spin_unlock(&opened_lock);
152
153 return 0;
154out_close:
155 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
156 lp->fd = -1;
157out:
158 spin_unlock(&lp->lock);
159 return err;
151} 160}
152 161
153static int uml_net_close(struct net_device *dev) 162static int uml_net_close(struct net_device *dev)
@@ -161,9 +170,13 @@ static int uml_net_close(struct net_device *dev)
161 if(lp->close != NULL) 170 if(lp->close != NULL)
162 (*lp->close)(lp->fd, &lp->user); 171 (*lp->close)(lp->fd, &lp->user);
163 lp->fd = -1; 172 lp->fd = -1;
164 list_del(&lp->list);
165 173
166 spin_unlock(&lp->lock); 174 spin_unlock(&lp->lock);
175
176 spin_lock(&opened_lock);
177 list_del(&lp->list);
178 spin_unlock(&opened_lock);
179
167 return 0; 180 return 0;
168} 181}
169 182
@@ -410,11 +423,7 @@ static int eth_configure(int n, void *init, char *mac,
410 if (device->have_mac) 423 if (device->have_mac)
411 set_ether_mac(dev, device->mac); 424 set_ether_mac(dev, device->mac);
412 425
413 spin_lock(&opened_lock); 426 return 0;
414 list_add(&lp->list, &opened);
415 spin_unlock(&opened_lock);
416
417 return(0);
418} 427}
419 428
420static struct uml_net *find_device(int n) 429static struct uml_net *find_device(int n)