Commit e72a1850 authored by Harald Welte's avatar Harald Welte

icE1usb: raise NOTOPEN alarm if 'startup' fails

This is what happens if there is insufficient isochronous USB bandwidth
to open a port: The STARTUP ioctl fails.  However, as the prior
SPANCONFIG ioctl succeeds, the line apears up with no alarms.

So let's set the NOTOPEN alarm whenever there are errors in STARTUP,
to give a clear indication to the user the port could not be opened.
parent 602302b4
......@@ -710,6 +710,7 @@ static int ice1usb_set_altif(struct ice1usb *ieu, bool on);
static int e1u_d_startup(struct file *file, struct dahdi_span *span)
{
struct ice1usb *ieu = container_of(span, struct ice1usb, dahdi.span);
unsigned long flags;
unsigned int i;
int rc;
......@@ -718,7 +719,7 @@ static int e1u_d_startup(struct file *file, struct dahdi_span *span)
/* Ensure we are in the right altsetting */
rc = ice1usb_set_altif(ieu, true);
if (rc < 0)
return rc;
goto err;
if (!test_and_set_bit(ICE1USB_ISOC_RUNNING, &ieu->flags)) {
for (i = 0; i < ICE1USB_NUM_URBS; i++) {
......@@ -753,6 +754,10 @@ static int e1u_d_startup(struct file *file, struct dahdi_span *span)
}
}
spin_lock_irqsave(&span->lock, flags);
span->alarms &= ~DAHDI_ALARM_NOTOPEN;
dahdi_alarm_notify(span);
spin_unlock_irqrestore(&span->lock, flags);
return 0;
err_irq:
......@@ -764,6 +769,11 @@ err_isoc:
usb_kill_anchored_urbs(&ieu->anchor.iso_fb);
clear_bit(ICE1USB_ISOC_RUNNING, &ieu->flags);
ice1usb_set_altif(ieu, false);
err:
spin_lock_irqsave(&span->lock, flags);
span->alarms |= DAHDI_ALARM_NOTOPEN;
dahdi_alarm_notify(span);
spin_unlock_irqrestore(&span->lock, flags);
return rc;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment