xpp: prevent double dahdi un-registration
* It's currently harmless (just re-run the pre/post XPD registrations) * But it's cleaner this way (as with xbus_register_dahdi_device()) Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
parent
193c9e59a8
commit
5e24d501c5
@ -1040,6 +1040,13 @@ void xbus_unregister_dahdi_device(xbus_t *xbus)
|
||||
XBUS_ERR(xbus, "dahdi_registration_mutex already taken\n");
|
||||
return;
|
||||
}
|
||||
if (!xbus_is_registered(xbus)) {
|
||||
/*
|
||||
* Ignore duplicate unregistrations
|
||||
*/
|
||||
XBUS_DBG(DEVICES, xbus, "Already unregistered to DAHDI\n");
|
||||
goto err;
|
||||
}
|
||||
for (i = 0; i < MAX_XPDS; i++) {
|
||||
xpd_t *xpd = xpd_of(xbus, i);
|
||||
xpd_dahdi_preunregister(xpd);
|
||||
@ -1054,6 +1061,7 @@ void xbus_unregister_dahdi_device(xbus_t *xbus)
|
||||
xpd_t *xpd = xpd_of(xbus, i);
|
||||
xpd_dahdi_postunregister(xpd);
|
||||
}
|
||||
err:
|
||||
mutex_unlock(&dahdi_registration_mutex);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user