-/* $OpenBSD: dev.c,v 1.82 2021/01/28 11:15:31 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.83 2021/01/28 11:17:58 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
c->ops = NULL;
}
+ midi_abort(d->midi);
+
if (d->pstate != DEV_CFG)
dev_close(d);
}
-/* $OpenBSD: midi.c,v 1.26 2021/01/12 15:46:53 naddy Exp $ */
+/* $OpenBSD: midi.c,v 1.27 2021/01/28 11:17:58 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
}
}
+/*
+ * disconnect clients attached to this end-point
+ */
+void
+midi_abort(struct midi *p)
+{
+ int i;
+ struct midi *ep;
+
+ for (i = 0; i < MIDI_NEP; i++) {
+ ep = midi_ep + i;
+ if ((ep->txmask & p->self) || (p->txmask & ep->self))
+ ep->ops->exit(ep->arg);
+ }
+}
+
void
port_log(struct port *p)
{
return 1;
}
-void
-port_abort(struct port *c)
-{
- int i;
- struct midi *ep;
-
- for (i = 0; i < MIDI_NEP; i++) {
- ep = midi_ep + i;
- if ((ep->txmask & c->midi->self) ||
- (c->midi->txmask & ep->self))
- ep->ops->exit(ep->arg);
- }
-
- if (c->state != PORT_CFG)
- port_close(c);
-}
-
int
port_close(struct port *c)
{
-/* $OpenBSD: midi.h,v 1.13 2020/06/12 15:40:18 ratchov Exp $ */
+/* $OpenBSD: midi.h,v 1.14 2021/01/28 11:17:58 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
void midi_tag(struct midi *, unsigned int);
unsigned int midi_tags(struct midi *);
void midi_link(struct midi *, struct midi *);
+void midi_abort(struct midi *);
void port_log(struct port *);
struct port *port_new(char *, unsigned int, int);
void port_drain(struct port *);
int port_close(struct port *);
int port_reopen(struct port *);
-void port_abort(struct port *);
#endif /* !defined(MIDI_H) */
-/* $OpenBSD: miofile.c,v 1.7 2020/06/12 15:40:18 ratchov Exp $ */
+/* $OpenBSD: miofile.c,v 1.8 2021/01/28 11:17:58 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
{
struct port *p = arg;
- if (!port_reopen(p))
- port_abort(p);
+ if (!port_reopen(p)) {
+ midi_abort(p->midi);
+ if (p->state != PORT_CFG)
+ port_close(p);
+ }
}