int avdtp_abort(struct avdtp *session, struct avdtp_stream *stream)
{
	struct seid_req req;
	int ret;

	if (!stream && session->discover) {
		/* Don't call cb since it being aborted */
		session->discover->cb = NULL;
		finalize_discovery(session, ECANCELED);
		return -EALREADY;
	}

	if (!g_slist_find(session->streams, stream))
		return -EINVAL;

	if (stream->lsep->state == AVDTP_STATE_ABORTING)
		return -EINVAL;

	avdtp_sep_set_state(session, stream->lsep, AVDTP_STATE_ABORTING);

	if (session->req && stream == session->req->stream)
		return cancel_request(session, ECANCELED);

	memset(&req, 0, sizeof(req));
	req.acp_seid = stream->rseid;

	ret = send_request(session, TRUE, stream, AVDTP_ABORT,
							&req, sizeof(req));
	if (ret == 0) {
		stream->abort_int = TRUE;
		session->dc_timeout = 0;
	}

	return ret;
}
int avdtp_abort(struct avdtp *session, struct avdtp_stream *stream)
{
	struct seid_req req;
	int ret;

	if (!stream && session->discover) {
		 
		session->discover->cb = NULL;
		finalize_discovery(session, ECANCELED);
		return -EALREADY;
	}

	if (!g_slist_find(session->streams, stream))
		return -EINVAL;

	if (stream->lsep->state == AVDTP_STATE_ABORTING)
		return -EINVAL;

	avdtp_sep_set_state(session, stream->lsep, AVDTP_STATE_ABORTING);

	if (session->req && stream == session->req->stream)
		return cancel_request(session, ECANCELED);

	memset(&req, 0, sizeof(req));
	req.acp_seid = stream->rseid;

	ret = send_request(session, TRUE, stream, AVDTP_ABORT,
							&req, sizeof(req));
	if (ret == 0) {
		stream->abort_int = TRUE;
		session->dc_timeout = 0;
	}

	return ret;
}