From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E404C433EF for ; Thu, 17 Feb 2022 18:41:04 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1DE1383B5A; Thu, 17 Feb 2022 19:41:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=permerror header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="UbMDw1aN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D0DA83B55; Thu, 17 Feb 2022 19:41:00 +0100 (CET) Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 85A5483B97 for ; Thu, 17 Feb 2022 19:40:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=permerror header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.behun@nic.cz Received: from dellmb (unknown [IPv6:2001:1488:fffe:6:8747:7254:5571:3010]) by mail.nic.cz (Postfix) with ESMTPSA id 28E5F140AA1; Thu, 17 Feb 2022 19:40:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1645123253; bh=a0OS89nw801FVe1HH8VOYrf5mxlTX6JKUGCvJ8Ywhvk=; h=Date:From:To; b=UbMDw1aN3Lpny17txzdDntnRiQFejNYeeBx7nu8SPZZbLr4igqS8i2GGi2tCOcRW8 azRMrRf7J5y9g1uQBQRJ7gicBbB9PsQJeNuNPeSjX/hwvpxgwYSoSgEVria+jvb+jp elwhJyAiMgbDbcOuVyMGGXpLoDY0iwd7GyuxgqJo= Date: Thu, 17 Feb 2022 19:40:52 +0100 From: Marek =?UTF-8?B?QmVow7pu?= To: Pali =?UTF-8?B?Um9ow6Fy?= Cc: Stefan Roese , Konstantin Porotchkin , Vladimir Vid , u-boot@lists.denx.de Subject: Re: [PATCH u-boot-mvebu 4/5] arm: mvebu: a37xx: Extend mbox_do_cmd() code Message-ID: <20220217194052.24c5b2d7@dellmb> In-Reply-To: <20220217171317.xjopq2hfg7l3utiv@pali> References: <20220217092619.1445-1-pali@kernel.org> <20220217092619.1445-5-pali@kernel.org> <20220217151633.242aa231@dellmb> <20220217171317.xjopq2hfg7l3utiv@pali> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On Thu, 17 Feb 2022 18:13:17 +0100 Pali Roh=C3=A1r wrote: > On Thursday 17 February 2022 15:16:33 Marek Beh=C3=BAn wrote: > > On Thu, 17 Feb 2022 10:26:18 +0100 > > Pali Roh=C3=A1r wrote: > > =20 > > > Allow to specify input parameters, define all available mbox commands > > > supported by CZ.NIC secure firmware + Marvell fuse.bin firmware and f= ix =20 > > CZ.NIC's and also Marvell's =20 > > > parsing response from Marvell OTP commands. > > >=20 > > > Signed-off-by: Pali Roh=C3=A1r =20 > >=20 > > ... > > =20 > > > #define MBOX_STS_ERROR(s) ((s) & (3 << 30)) > > > #define MBOX_STS_VALUE(s) (((s) >> 10) & 0xfffff) > > > #define MBOX_STS_CMD(s) ((s) & 0x3ff) > > > +#define MBOX_STS_MARVELL_ERROR(s) ((s) =3D=3D 0 ? 0 : (s) =3D=3D 2 ?= ETIMEDOUT : (s) =3D=3D 3 ? EINVAL : (s) =3D=3D 4 ? ENOSYS : EIO) =20 > >=20 > > This is starting to become too complicated for a macro :-( =20 >=20 > It is straightforward switch macro. I can reformat it to be more > readable, e.g.: >=20 > #define MBOX_STS_MARVELL_ERROR(s) ((s) =3D=3D 0 ? 0 : \ > (s) =3D=3D 2 ? ETIMEDOUT : \ > (s) =3D=3D 3 ? EINVAL : \ > (s) =3D=3D 4 ? ENOSYS : \ > EIO) I would still prefer static functions for such expressions, but this formatting is better then nothing. If you resend with this formatting, you can add my Reviewed-by. Marek