diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/net/wan/dlci.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/net/wan/dlci.c')
-rw-r--r-- | drivers/net/wan/dlci.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c index 421d0715310e..21b104db5a90 100644 --- a/drivers/net/wan/dlci.c +++ b/drivers/net/wan/dlci.c | |||
@@ -97,11 +97,11 @@ static int dlci_header(struct sk_buff *skb, struct net_device *dev, | |||
97 | 97 | ||
98 | dest = skb_push(skb, hlen); | 98 | dest = skb_push(skb, hlen); |
99 | if (!dest) | 99 | if (!dest) |
100 | return(0); | 100 | return 0; |
101 | 101 | ||
102 | memcpy(dest, &hdr, hlen); | 102 | memcpy(dest, &hdr, hlen); |
103 | 103 | ||
104 | return(hlen); | 104 | return hlen; |
105 | } | 105 | } |
106 | 106 | ||
107 | static void dlci_receive(struct sk_buff *skb, struct net_device *dev) | 107 | static void dlci_receive(struct sk_buff *skb, struct net_device *dev) |
@@ -211,14 +211,14 @@ static int dlci_config(struct net_device *dev, struct dlci_conf __user *conf, in | |||
211 | if (copy_from_user(&config, conf, sizeof(struct dlci_conf))) | 211 | if (copy_from_user(&config, conf, sizeof(struct dlci_conf))) |
212 | return -EFAULT; | 212 | return -EFAULT; |
213 | if (config.flags & ~DLCI_VALID_FLAGS) | 213 | if (config.flags & ~DLCI_VALID_FLAGS) |
214 | return(-EINVAL); | 214 | return -EINVAL; |
215 | memcpy(&dlp->config, &config, sizeof(struct dlci_conf)); | 215 | memcpy(&dlp->config, &config, sizeof(struct dlci_conf)); |
216 | dlp->configured = 1; | 216 | dlp->configured = 1; |
217 | } | 217 | } |
218 | 218 | ||
219 | err = (*flp->dlci_conf)(dlp->slave, dev, get); | 219 | err = (*flp->dlci_conf)(dlp->slave, dev, get); |
220 | if (err) | 220 | if (err) |
221 | return(err); | 221 | return err; |
222 | 222 | ||
223 | if (get) | 223 | if (get) |
224 | { | 224 | { |
@@ -226,7 +226,7 @@ static int dlci_config(struct net_device *dev, struct dlci_conf __user *conf, in | |||
226 | return -EFAULT; | 226 | return -EFAULT; |
227 | } | 227 | } |
228 | 228 | ||
229 | return(0); | 229 | return 0; |
230 | } | 230 | } |
231 | 231 | ||
232 | static int dlci_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 232 | static int dlci_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
@@ -234,7 +234,7 @@ static int dlci_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
234 | struct dlci_local *dlp; | 234 | struct dlci_local *dlp; |
235 | 235 | ||
236 | if (!capable(CAP_NET_ADMIN)) | 236 | if (!capable(CAP_NET_ADMIN)) |
237 | return(-EPERM); | 237 | return -EPERM; |
238 | 238 | ||
239 | dlp = netdev_priv(dev); | 239 | dlp = netdev_priv(dev); |
240 | 240 | ||
@@ -242,7 +242,7 @@ static int dlci_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
242 | { | 242 | { |
243 | case DLCI_GET_SLAVE: | 243 | case DLCI_GET_SLAVE: |
244 | if (!*(short *)(dev->dev_addr)) | 244 | if (!*(short *)(dev->dev_addr)) |
245 | return(-EINVAL); | 245 | return -EINVAL; |
246 | 246 | ||
247 | strncpy(ifr->ifr_slave, dlp->slave->name, sizeof(ifr->ifr_slave)); | 247 | strncpy(ifr->ifr_slave, dlp->slave->name, sizeof(ifr->ifr_slave)); |
248 | break; | 248 | break; |
@@ -250,15 +250,15 @@ static int dlci_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
250 | case DLCI_GET_CONF: | 250 | case DLCI_GET_CONF: |
251 | case DLCI_SET_CONF: | 251 | case DLCI_SET_CONF: |
252 | if (!*(short *)(dev->dev_addr)) | 252 | if (!*(short *)(dev->dev_addr)) |
253 | return(-EINVAL); | 253 | return -EINVAL; |
254 | 254 | ||
255 | return(dlci_config(dev, ifr->ifr_data, cmd == DLCI_GET_CONF)); | 255 | return dlci_config(dev, ifr->ifr_data, cmd == DLCI_GET_CONF); |
256 | break; | 256 | break; |
257 | 257 | ||
258 | default: | 258 | default: |
259 | return(-EOPNOTSUPP); | 259 | return -EOPNOTSUPP; |
260 | } | 260 | } |
261 | return(0); | 261 | return 0; |
262 | } | 262 | } |
263 | 263 | ||
264 | static int dlci_change_mtu(struct net_device *dev, int new_mtu) | 264 | static int dlci_change_mtu(struct net_device *dev, int new_mtu) |
@@ -277,15 +277,15 @@ static int dlci_open(struct net_device *dev) | |||
277 | dlp = netdev_priv(dev); | 277 | dlp = netdev_priv(dev); |
278 | 278 | ||
279 | if (!*(short *)(dev->dev_addr)) | 279 | if (!*(short *)(dev->dev_addr)) |
280 | return(-EINVAL); | 280 | return -EINVAL; |
281 | 281 | ||
282 | if (!netif_running(dlp->slave)) | 282 | if (!netif_running(dlp->slave)) |
283 | return(-ENOTCONN); | 283 | return -ENOTCONN; |
284 | 284 | ||
285 | flp = netdev_priv(dlp->slave); | 285 | flp = netdev_priv(dlp->slave); |
286 | err = (*flp->activate)(dlp->slave, dev); | 286 | err = (*flp->activate)(dlp->slave, dev); |
287 | if (err) | 287 | if (err) |
288 | return(err); | 288 | return err; |
289 | 289 | ||
290 | netif_start_queue(dev); | 290 | netif_start_queue(dev); |
291 | 291 | ||
@@ -341,10 +341,6 @@ static int dlci_add(struct dlci_add *dlci) | |||
341 | } | 341 | } |
342 | } | 342 | } |
343 | 343 | ||
344 | err = dev_alloc_name(master, master->name); | ||
345 | if (err < 0) | ||
346 | goto err2; | ||
347 | |||
348 | *(short *)(master->dev_addr) = dlci->dlci; | 344 | *(short *)(master->dev_addr) = dlci->dlci; |
349 | 345 | ||
350 | dlp = netdev_priv(master); | 346 | dlp = netdev_priv(master); |
@@ -365,14 +361,14 @@ static int dlci_add(struct dlci_add *dlci) | |||
365 | list_add(&dlp->list, &dlci_devs); | 361 | list_add(&dlp->list, &dlci_devs); |
366 | rtnl_unlock(); | 362 | rtnl_unlock(); |
367 | 363 | ||
368 | return(0); | 364 | return 0; |
369 | 365 | ||
370 | err2: | 366 | err2: |
371 | rtnl_unlock(); | 367 | rtnl_unlock(); |
372 | free_netdev(master); | 368 | free_netdev(master); |
373 | err1: | 369 | err1: |
374 | dev_put(slave); | 370 | dev_put(slave); |
375 | return(err); | 371 | return err; |
376 | } | 372 | } |
377 | 373 | ||
378 | static int dlci_del(struct dlci_add *dlci) | 374 | static int dlci_del(struct dlci_add *dlci) |
@@ -385,10 +381,10 @@ static int dlci_del(struct dlci_add *dlci) | |||
385 | /* validate slave device */ | 381 | /* validate slave device */ |
386 | master = __dev_get_by_name(&init_net, dlci->devname); | 382 | master = __dev_get_by_name(&init_net, dlci->devname); |
387 | if (!master) | 383 | if (!master) |
388 | return(-ENODEV); | 384 | return -ENODEV; |
389 | 385 | ||
390 | if (netif_running(master)) { | 386 | if (netif_running(master)) { |
391 | return(-EBUSY); | 387 | return -EBUSY; |
392 | } | 388 | } |
393 | 389 | ||
394 | dlp = netdev_priv(master); | 390 | dlp = netdev_priv(master); |
@@ -406,7 +402,7 @@ static int dlci_del(struct dlci_add *dlci) | |||
406 | } | 402 | } |
407 | rtnl_unlock(); | 403 | rtnl_unlock(); |
408 | 404 | ||
409 | return(err); | 405 | return err; |
410 | } | 406 | } |
411 | 407 | ||
412 | static int dlci_ioctl(unsigned int cmd, void __user *arg) | 408 | static int dlci_ioctl(unsigned int cmd, void __user *arg) |
@@ -415,7 +411,7 @@ static int dlci_ioctl(unsigned int cmd, void __user *arg) | |||
415 | int err; | 411 | int err; |
416 | 412 | ||
417 | if (!capable(CAP_NET_ADMIN)) | 413 | if (!capable(CAP_NET_ADMIN)) |
418 | return(-EPERM); | 414 | return -EPERM; |
419 | 415 | ||
420 | if (copy_from_user(&add, arg, sizeof(struct dlci_add))) | 416 | if (copy_from_user(&add, arg, sizeof(struct dlci_add))) |
421 | return -EFAULT; | 417 | return -EFAULT; |
@@ -438,7 +434,7 @@ static int dlci_ioctl(unsigned int cmd, void __user *arg) | |||
438 | err = -EINVAL; | 434 | err = -EINVAL; |
439 | } | 435 | } |
440 | 436 | ||
441 | return(err); | 437 | return err; |
442 | } | 438 | } |
443 | 439 | ||
444 | static const struct header_ops dlci_header_ops = { | 440 | static const struct header_ops dlci_header_ops = { |