From: Tanu Kaskinen Date: Mon, 19 Feb 2018 14:48:19 +0000 (+0200) Subject: alsa, solaris, oss: remove unnecessary error handling when suspending X-Git-Tag: v11.99.1~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f201b1fd419b91a226d23ee1e216661ae082dcf;p=platform%2Fupstream%2Fpulseaudio.git alsa, solaris, oss: remove unnecessary error handling when suspending Suspending never fails. --- diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 5e81728..fe0a21a 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -939,7 +939,7 @@ static int build_pollfd(struct userdata *u) { } /* Called from IO context */ -static int suspend(struct userdata *u) { +static void suspend(struct userdata *u) { pa_assert(u); pa_assert(u->pcm_handle); @@ -964,8 +964,6 @@ static int suspend(struct userdata *u) { pa_sink_set_max_request_within_thread(u->sink, 0); pa_log_info("Device suspended..."); - - return 0; } /* Called from IO context */ @@ -1192,12 +1190,9 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse switch ((pa_sink_state_t) PA_PTR_TO_UINT(data)) { case PA_SINK_SUSPENDED: { - int r; - pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state)); - if ((r = suspend(u)) < 0) - return r; + suspend(u); break; } diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index 79d3364..b11a03f 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -837,7 +837,7 @@ static int build_pollfd(struct userdata *u) { } /* Called from IO context */ -static int suspend(struct userdata *u) { +static void suspend(struct userdata *u) { pa_assert(u); pa_assert(u->pcm_handle); @@ -853,8 +853,6 @@ static int suspend(struct userdata *u) { } pa_log_info("Device suspended..."); - - return 0; } /* Called from IO context */ @@ -1047,12 +1045,9 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off switch ((pa_source_state_t) PA_PTR_TO_UINT(data)) { case PA_SOURCE_SUSPENDED: { - int r; - pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state)); - if ((r = suspend(u)) < 0) - return r; + suspend(u); break; } diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c index 880aa43..a4960b8 100644 --- a/src/modules/module-solaris.c +++ b/src/modules/module-solaris.c @@ -348,7 +348,7 @@ static int open_audio_device(struct userdata *u, pa_sample_spec *ss) { return u->fd; } -static int suspend(struct userdata *u) { +static void suspend(struct userdata *u) { pa_assert(u); pa_assert(u->fd >= 0); @@ -364,8 +364,6 @@ static int suspend(struct userdata *u) { } pa_log_info("Device suspended."); - - return 0; } static int unsuspend(struct userdata *u) { @@ -403,10 +401,9 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse pa_smoother_pause(u->smoother, pa_rtclock_now()); - if (!u->source || u->source_suspended) { - if (suspend(u) < 0) - return -1; - } + if (!u->source || u->source_suspended) + suspend(u); + u->sink_suspended = true; break; @@ -457,10 +454,9 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state)); - if (!u->sink || u->sink_suspended) { - if (suspend(u) < 0) - return -1; - } + if (!u->sink || u->sink_suspended) + suspend(u); + u->source_suspended = true; break; diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c index 93b55ad..fb978b5 100644 --- a/src/modules/oss/module-oss.c +++ b/src/modules/oss/module-oss.c @@ -485,7 +485,7 @@ static void build_pollfd(struct userdata *u) { } /* Called from IO context */ -static int suspend(struct userdata *u) { +static void suspend(struct userdata *u) { pa_assert(u); pa_assert(u->fd >= 0); @@ -530,8 +530,6 @@ static int suspend(struct userdata *u) { } pa_log_info("Device suspended..."); - - return 0; } /* Called from IO context */ @@ -670,10 +668,8 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse case PA_SINK_SUSPENDED: pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state)); - if (!u->source || u->source_suspended) { - if (suspend(u) < 0) - return -1; - } + if (!u->source || u->source_suspended) + suspend(u); do_trigger = true; @@ -753,10 +749,8 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off case PA_SOURCE_SUSPENDED: pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state)); - if (!u->sink || u->sink_suspended) { - if (suspend(u) < 0) - return -1; - } + if (!u->sink || u->sink_suspended) + suspend(u); do_trigger = true;