diff options
author | Stanislaw Gruszka <stf_xl@wp.pl> | 2005-11-29 19:16:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-11-29 19:16:41 -0500 |
commit | 64bf69ddff7637b7ed7acf9b2a823cc0ee519439 (patch) | |
tree | fb3a746e36bcfa307979bef2a20ce5f1d32ec537 /include/linux/atmdev.h | |
parent | aaaaaadbe7a663d110814db50fcbe7d320eb4c32 (diff) |
[ATM]: deregistration removes device from atm_devs list immediately
atm_dev_deregister() removes device from atm_dev list immediately to
prevent operations on a phantom device. Decision to free device based
only on ->refcnt now. Remove shutdown_atm_dev() use atm_dev_deregister()
instead. atm_dev_deregister() also asynchronously releases all vccs
related to device.
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/atmdev.h')
-rw-r--r-- | include/linux/atmdev.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index 8fadb073c834..b203ea82a0a8 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h | |||
@@ -274,7 +274,7 @@ enum { | |||
274 | 274 | ||
275 | 275 | ||
276 | enum { | 276 | enum { |
277 | ATM_DF_CLOSE, /* close device when last VCC is closed */ | 277 | ATM_DF_REMOVED, /* device was removed from atm_devs list */ |
278 | }; | 278 | }; |
279 | 279 | ||
280 | 280 | ||
@@ -415,7 +415,6 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops, | |||
415 | int number,unsigned long *flags); /* number == -1: pick first available */ | 415 | int number,unsigned long *flags); /* number == -1: pick first available */ |
416 | struct atm_dev *atm_dev_lookup(int number); | 416 | struct atm_dev *atm_dev_lookup(int number); |
417 | void atm_dev_deregister(struct atm_dev *dev); | 417 | void atm_dev_deregister(struct atm_dev *dev); |
418 | void shutdown_atm_dev(struct atm_dev *dev); | ||
419 | void vcc_insert_socket(struct sock *sk); | 418 | void vcc_insert_socket(struct sock *sk); |
420 | 419 | ||
421 | 420 | ||
@@ -457,11 +456,12 @@ static inline void atm_dev_hold(struct atm_dev *dev) | |||
457 | 456 | ||
458 | static inline void atm_dev_put(struct atm_dev *dev) | 457 | static inline void atm_dev_put(struct atm_dev *dev) |
459 | { | 458 | { |
460 | atomic_dec(&dev->refcnt); | 459 | if (atomic_dec_and_test(&dev->refcnt)) { |
461 | 460 | BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); | |
462 | if ((atomic_read(&dev->refcnt) == 1) && | 461 | if (dev->ops->dev_close) |
463 | test_bit(ATM_DF_CLOSE,&dev->flags)) | 462 | dev->ops->dev_close(dev); |
464 | shutdown_atm_dev(dev); | 463 | kfree(dev); |
464 | } | ||
465 | } | 465 | } |
466 | 466 | ||
467 | 467 | ||