Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3988758ybp; Mon, 7 Oct 2019 01:04:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGj39+AEKtGkU0aESLLcGVLHLUXr6vplJ3OyK0/pnhbUoOtCvXOis1+5JhT/DDyWQiS7Wu X-Received: by 2002:a05:6402:1a52:: with SMTP id bf18mr27810863edb.67.1570435477758; Mon, 07 Oct 2019 01:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570435477; cv=none; d=google.com; s=arc-20160816; b=hphLVXGQ2dpV08roa0Wt9NW7+garpymN5Jl+bSVXyGInQXSYe/i76SLviAczGNaZWX 2vqQcMjxDWS90awPCjYjMmQ7Jizd8PXPgOjqoMtCsxMzkFwmM2GJUMZlVF0IQtDoy/CB E1ZO15/5S0UTJnp7x8QfxUyqJeB2yUsvFBpBMs6U/7LwUv1sfUu/wD7Use9Q2MvvfD86 hp6pDyMQkx03hYZ5JhUY/uoI8vvfHhPy/edfhiW4+0gBjrH2MZOEFTYWWhtxErIaScJD /A9MLA8mjbB90qnwk2DS+l97XbBs4L1vCsBygZqtLyrEX56PBWEkdl2/nDpvfH4xrs8m Z7Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4mVgSyq9xVLtLcw+FvpZr6ImVo/casGTZ2ZBrbAS1Y8=; b=wEyA1T9kxDj34SmgSmLQyiqxbpCs9pLiguv4m23jkNooo7PW23F8qM1z3GDSBgslom SIImvoggirs0nmYzvlOpbQkVKL5y//ziavYahG6rlLR95yfy/HFaGIKgzycVkjmfSWDz JDKghmckmVTfiByPrmLv38DKcNW4Usbb/ws0JiGfEIs+8KHqRa7Ts8EDzfBYbuhgo1LJ MTLM6m/FjBkA3h7jkYQS371A/2Qg4zh9nnF3csqLMjJnGKVHyktLZ/eh1MZGMDeJqtHl hF9jkB1JAjfEWodElB7ou5ZnTHjDUpQoqqv8xKybmpIqf8rYTJ7BilqLtw/YUJ3QCQHT xFGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ha16si969253ejb.258.2019.10.07.01.04.14; Mon, 07 Oct 2019 01:04:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727305AbfJGIBm (ORCPT + 99 others); Mon, 7 Oct 2019 04:01:42 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:36803 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726889AbfJGIBl (ORCPT ); Mon, 7 Oct 2019 04:01:41 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iHNxY-0001wb-US; Mon, 07 Oct 2019 10:01:36 +0200 Received: from mfe by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iHNxX-0003ly-Hb; Mon, 07 Oct 2019 10:01:35 +0200 Date: Mon, 7 Oct 2019 10:01:35 +0200 From: Marco Felsch To: Anson Huang Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, aisheng.dong@nxp.com, leonard.crestez@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linux-imx@nxp.com Subject: Re: [PATCH V2] firmware: imx: Skip return value check for some special SCU firmware APIs Message-ID: <20191007080135.4e5ljhh6z2rbx5bw@pengutronix.de> References: <1570410959-32563-1-git-send-email-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1570410959-32563-1-git-send-email-Anson.Huang@nxp.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 09:59:23 up 142 days, 14:17, 94 users, load average: 0.03, 0.07, 0.11 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anson, On 19-10-07 09:15, Anson Huang wrote: > The SCU firmware does NOT always have return value stored in message > header's function element even the API has response data, those special > APIs are defined as void function in SCU firmware, so they should be > treated as return success always. > > Signed-off-by: Anson Huang > --- > Changes since V1: > - Use direct API check instead of calling another function to check. > - This patch is based on https://patchwork.kernel.org/patch/11129553/ Thanks for this v2. It would be good to change the callers within this series. Regards, Marco > --- > drivers/firmware/imx/imx-scu.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c > index 869be7a..03b43b7 100644 > --- a/drivers/firmware/imx/imx-scu.c > +++ b/drivers/firmware/imx/imx-scu.c > @@ -162,6 +162,7 @@ static int imx_scu_ipc_write(struct imx_sc_ipc *sc_ipc, void *msg) > */ > int imx_scu_call_rpc(struct imx_sc_ipc *sc_ipc, void *msg, bool have_resp) > { > + uint8_t saved_svc, saved_func; > struct imx_sc_rpc_msg *hdr; > int ret; > > @@ -171,8 +172,11 @@ int imx_scu_call_rpc(struct imx_sc_ipc *sc_ipc, void *msg, bool have_resp) > mutex_lock(&sc_ipc->lock); > reinit_completion(&sc_ipc->done); > > - if (have_resp) > + if (have_resp) { > sc_ipc->msg = msg; > + saved_svc = ((struct imx_sc_rpc_msg *)msg)->svc; > + saved_func = ((struct imx_sc_rpc_msg *)msg)->func; > + } > sc_ipc->count = 0; > ret = imx_scu_ipc_write(sc_ipc, msg); > if (ret < 0) { > @@ -191,6 +195,16 @@ int imx_scu_call_rpc(struct imx_sc_ipc *sc_ipc, void *msg, bool have_resp) > /* response status is stored in hdr->func field */ > hdr = msg; > ret = hdr->func; > + /* > + * Some special SCU firmware APIs do NOT have return value > + * in hdr->func, but they do have response data, those special > + * APIs are defined as void function in SCU firmware, so they > + * should be treated as return success always. > + */ > + if ((saved_svc == IMX_SC_RPC_SVC_MISC) && > + (saved_func == IMX_SC_MISC_FUNC_UNIQUE_ID || > + saved_func == IMX_SC_MISC_FUNC_GET_BUTTON_STATUS)) > + ret = 0; > } > > out: > -- > 2.7.4 > > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |