diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2011-10-26 18:56:43 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2011-10-26 18:56:43 +0000 |
commit | 9cbd090e5dc8fbd80b58f7d8e0e42ee9e52ca526 (patch) | |
tree | 524c2cc8c562610b13e858b0e5d27cb18f964d85 /drivers/dahdi/xpp/xpp_dahdi.c | |
parent | ffaa9fa9648f2b8ab4052aae63977b41704ade47 (diff) |
dahdi: start handling "surprise device removal".
This patch contains interim results while trying to make
device removal work correctly:
* XPP has protections to prevent dahdi unregistration while
channels are open -- they are now removed, so we can
unregister immediately.
* Handle processes in poll_wait():
- Wake them during dahdi_chan_unreg() after the channel
is gone (chan->channo = -1 or chan->file->private_data == NULL)
- Test in every wait_event_interruptible() that the channel
was not gone (chan->file->private_data)
- Return correct values (POLLERR | POLLHUP) instead of
some errno (would be important in the future if we
modify asterisk to respond correctly to this condition.
* Other issues:
- If unregistered channel is being polled, than call msleep() before
returning, to give other processes a chance (normally, asterisk
has RT priority)
- Call close_channel() from dahdi_chan_unreg() so it releases
related tonezone
* There is still a horrible race hidden by msleep(20) in
dahdi_chan_unreg()
force close channels from dahdi_chan_unreg():
* Mark them via DAHDI_FLAGBIT_OPEN
* Call low-level driver close() method if available
* What about other closing activities?
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10270 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/xpp/xpp_dahdi.c')
-rw-r--r-- | drivers/dahdi/xpp/xpp_dahdi.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/drivers/dahdi/xpp/xpp_dahdi.c b/drivers/dahdi/xpp/xpp_dahdi.c index 2de7845..0f186ef 100644 --- a/drivers/dahdi/xpp/xpp_dahdi.c +++ b/drivers/dahdi/xpp/xpp_dahdi.c @@ -734,7 +734,6 @@ int xpp_open(struct dahdi_chan *chan) return -EINVAL; } xpd = chan->pvt; - xpd = get_xpd(__FUNCTION__, xpd); /* Returned in xpp_close() */ if (!xpd) { NOTICE("open called on a chan with no pvt (xpd)\n"); BUG(); @@ -776,7 +775,6 @@ int xpp_close(struct dahdi_chan *chan) current->comm, current->pid, atomic_read(&PHONEDEV(xpd).open_counter)); atomic_dec(&PHONEDEV(xpd).open_counter); /* from xpp_open() */ - put_xpd(__FUNCTION__, xpd); /* from xpp_open() */ return 0; } @@ -1024,12 +1022,6 @@ int dahdi_unregister_xpd(xpd_t *xpd) return -EIDRM; } update_xpd_status(xpd, DAHDI_ALARM_NOTOPEN); - /* We should now have only a ref from the xbus (from create_xpd()) */ - if(atomic_read(&PHONEDEV(xpd).open_counter)) { - XPD_NOTICE(xpd, "Busy (open_counter=%d). Skipping.\n", atomic_read(&PHONEDEV(xpd).open_counter)); - spin_unlock_irqrestore(&xpd->lock, flags); - return -EBUSY; - } mdelay(2); // FIXME: This is to give chance for transmit/receiveprep to finish. spin_unlock_irqrestore(&xpd->lock, flags); if(xpd->card_present) |