From patchwork Fri Dec 4 10:01:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 337749 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp113135ilb; Fri, 4 Dec 2020 02:06:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwinUBLdVFr+cm5B5jWWlu0GoflccSDrfpaNPAcZReZjlpXpnxMWsxeqtwQBkWU96FB2doG X-Received: by 2002:a17:906:f2c3:: with SMTP id gz3mr6469214ejb.448.1607076296328; Fri, 04 Dec 2020 02:04:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607076296; cv=none; d=google.com; s=arc-20160816; b=aQfA0XELadNeBwZ1vDjazUKimhHlBGyt1Qg1eb0IF8WmSUaLGn9Fxvo6hwTCee1BW0 a4KqiZtjj697uzfVVFxHiqj42X3JNpj/VTjdJcuQERiBlIQJGtB1+1gYhaR14XqkdoGN jOMTEA/6wL5EJNd4N7hBDae7Num/bZ+aMtkAazasvm8JnWxc//L7sshwXgI2sHfWk2gr xpXRrtpTCxH3l9guwB7qrUx58XRFUfJh18j6l/eMOD3esU8PC9F/WahHMw7PSct/wx+p 1Q0foxcPrQEVpcCu1Iw3INGxdNOB6+LSx9kODF1yS8pwDWrXCtPeX9+/QcVssDYloQSX GtdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=fik6fEowz12+2Ryuqjd810QUwD4ENaiIRDI49CE7Imo=; b=RLmW414iUreN+v8eWT+GuU/Pti9/aTqnZKoEMAbfw4kZ/cbcUEKsN2G8hPiF24Gj2O Xl20P04mB3N/s1PiumtQ9mnV1fp5zhGqq7c8h1A9bD5syZV1VIAqnbRaTHA6BRxXwexn yQmrZU3Gql3x8hqgLw0xlPf4vXMDftExpO31UY8373rNWu4FxOVjs10ffBwIKsxVaoWf 6xF4hhuip6KLI09N2PE3gozY9WDGy8LAjZotyG5bsKhr+hQ/q605+teUiOpzJNIdfXEm WM7J0bB6OjiXWf/NQ/OhmUxeCT8VB+TuU95kSrMxXaIywYajmcH8956O4A2zsvWLLPOj ZirA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s0IPi2BA; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nq7si1077203ejb.109.2020.12.04.02.04.56; Fri, 04 Dec 2020 02:04:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s0IPi2BA; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387983AbgLDKDi (ORCPT + 4 others); Fri, 4 Dec 2020 05:03:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387902AbgLDKDd (ORCPT ); Fri, 4 Dec 2020 05:03:33 -0500 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC4EAC08E863 for ; Fri, 4 Dec 2020 02:02:13 -0800 (PST) Received: by mail-ej1-x642.google.com with SMTP id g20so7858857ejb.1 for ; Fri, 04 Dec 2020 02:02:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fik6fEowz12+2Ryuqjd810QUwD4ENaiIRDI49CE7Imo=; b=s0IPi2BAvrZXVg6MFhcozWTscLQzWG5DFcmiVlxDGmRFk0HHGu3rKsyxBoR2ctJDmS ybNq+4AZfWqrIOWlOwMMn9ypj6s/3xIywX/t+a5UUsOdWxhzpUNYUhXAEX4nOrMahzgl E2HbZZoHFdF9h0xQq7Ot8KVfRHaHcNhyfGw5gHPcN4Img0/YCjUtf2LlRFhe+ypQTA15 B/498boF+b3BY6jxxh1TnBalh1CtYptZLZF36jb5L6n7/fNUlHZolwjUIMDfEqW+QuC1 XZ7+YsaRBQJbZvr5SdtIoyuQXN+LxAxCAykzXM6hSWoNG7VV1IVkuB8tPfN783mK4Qyw zwEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fik6fEowz12+2Ryuqjd810QUwD4ENaiIRDI49CE7Imo=; b=qg5eXu/lK8TF6vR8crKy3RkDERRGquzmDVib7Vvyz8+Ec55O7ZEAM9LQKHlcTHqE18 M4NqI6kOYnHe6tgwNfxwAj4jcaz/OhfWPtR/c9hWPANHoLAA3hV9iaUQJPecIFtfV1PM dnNt/cUpj+RPH73n2q9tzsRldhXnPFR6sb0nAMdlGrfHo2RMc3ZItHZ+tH10NCGfjtS1 IJshjBhGLstvhI/Ecn1ltjRoacUaS7uSnaATijp+GdNjuOgW9GaHsBvCY4zirhVV/jVx 9tuBS1CSk7iOt2eGo1ElLs4pSoBxdqhJAeFshx7/HZ9isap1jUDAnOlbDNILxXWeu5uF RM2w== X-Gm-Message-State: AOAM530ZUNfsGQfVquDFRkBx46tiCHXMgd96nVEFR6Q5405lw2WeLq6k QngelqrNPYaiMkxiBFWDilSFNkmdk6SjNN66 X-Received: by 2002:a17:906:7aca:: with SMTP id k10mr6229230ejo.215.1607076132455; Fri, 04 Dec 2020 02:02:12 -0800 (PST) Received: from localhost.localdomain (hst-221-106.medicom.bg. [84.238.221.106]) by smtp.gmail.com with ESMTPSA id p35sm3238242edd.58.2020.12.04.02.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 02:02:11 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dikshita@codeaurora.org, Alexandre Courbot , Vikash Garodia , Stanimir Varbanov Subject: [PATCH v2 4/4] venus: hfi: Correct session init return error Date: Fri, 4 Dec 2020 12:01:39 +0200 Message-Id: <20201204100139.6216-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201204100139.6216-1-stanimir.varbanov@linaro.org> References: <20201204100139.6216-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The hfi_session_init can be called many times and it returns EINVAL when the session was already initialized. This error code (EINVAL) is confusing for the callers. Change hfi_session_init to return EALREADY error code when the session has been already initialized. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi.c | 2 +- drivers/media/platform/qcom/venus/vdec.c | 2 +- drivers/media/platform/qcom/venus/venc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 8786609d269e..0f2482367e06 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -221,7 +221,7 @@ int hfi_session_init(struct venus_inst *inst, u32 pixfmt) mutex_unlock(&core->lock); if (inst->state != INST_UNINIT) - return -EINVAL; + return -EALREADY; inst->hfi_codec = to_codec_type(pixfmt); reinit_completion(&inst->done); diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 8488411204c3..5337387eef27 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -741,7 +741,7 @@ static int vdec_session_init(struct venus_inst *inst) int ret; ret = hfi_session_init(inst, inst->fmt_out->pixfmt); - if (ret == -EINVAL) + if (ret == -EALREADY) return 0; else if (ret) return ret; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index e0053cc1b7eb..cb8ff10e38c7 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -725,7 +725,7 @@ static int venc_init_session(struct venus_inst *inst) int ret; ret = hfi_session_init(inst, inst->fmt_cap->pixfmt); - if (ret == -EINVAL) + if (ret == -EALREADY) return 0; else if (ret) return ret;