Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp655973ybp; Wed, 9 Oct 2019 02:03:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzANaaRx0PVCLxapySOVLflaNGNColXPr5qMaZ7iMegfv7cn8dfNbL3fYGe3EBudct+jFMa X-Received: by 2002:a17:906:c35a:: with SMTP id ci26mr1631589ejb.99.1570611820034; Wed, 09 Oct 2019 02:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570611820; cv=none; d=google.com; s=arc-20160816; b=Y2TqXr4yjnU1OuQCez2YT029Z8nBo3rwtPpGy27pMj+GXYtSLaJGN8fIdnPYT4+7Ce PHDEWYc7feghL2ZBDk5nwSorQzprx6EcGmoFXKiC8xbpMCFVUqm3/UK1RTvhkUu2qKwV LkyMe5Y0KTYpUnAily6iYyusVZJ4vdjRXdAtdmRIqE/Hv7DjsDmNXmE2nIoIzRjgJL7H BmpEmEwkvMhNrYLDVbDFYnjnrwrUu49VGC+jaCeM3a6NhSDyGFKl897LIfcXpui1q65v +jMVwZyYID7Ih8wgL/I6zZmE6cUwHOQQCXB2lEFvbWm+djZc4Jr1+7V3q1RO9NtA3xGq RAKg== 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=KegdDM3FhNFbZMSilU5PofavFy9G3rwjqS4gVPfEYWY=; b=IrnziN+sCHGM9ktkHbIclwC+6aSqki934xxAm4TRjYk59sO1xWyTff04Ob7lB2Ig/+ kVS37v8GPDvTniVVKmuMQIHvRu2+vuTQ5R158sF0k26Ds58onkCRXsmnFp5ds/Ke0Thk LnRNtL45NS6FnP9N/y2FrMffihb2qf+N9hkVpVXDVMVlU5IE0Fm2U34/8LWGtym8v7N7 ei/3dMb2kv/aPcGTxU8se6Yb6euz6FSrYDLYuTBbFQmFw+dXFFEV1v9SS+jBpre5CsZ1 K5m15drtTwZA+CBWw85JbujVzFwbT28Y4I6D7gBr1kMbsgMjCzpUzIQ933Ur5FHLx+DZ VEQQ== 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 b47si918662edc.45.2019.10.09.02.03.15; Wed, 09 Oct 2019 02:03:40 -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 S1726734AbfJIJAt (ORCPT + 99 others); Wed, 9 Oct 2019 05:00:49 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:50961 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725440AbfJIJAt (ORCPT ); Wed, 9 Oct 2019 05:00:49 -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 1iI7ps-0007lp-GU; Wed, 09 Oct 2019 11:00:44 +0200 Received: from mfe by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iI7pr-0007Ux-7Q; Wed, 09 Oct 2019 11:00:43 +0200 Date: Wed, 9 Oct 2019 11:00:43 +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: <20191009090043.4yq4l7iac3zgytnp@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: 10:58:09 up 144 days, 15:16, 97 users, load average: 0.08, 0.07, 0.07 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/ > --- > 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; Why do we need to check the svc too? > + saved_func = ((struct imx_sc_rpc_msg *)msg)->func; Nitpick, should we call it requested_func/req_func? Regards, Marco > + } > 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 |