Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4A67C433E7 for ; Wed, 2 Sep 2020 16:15:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A43E820639 for ; Wed, 2 Sep 2020 16:15:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="G2U7knBR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A43E820639 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lunn.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uwYUySTOkp5D3hI4WGIO6ghSvUVRLL/v2dx5I5T6zdM=; b=G2U7knBRhU/cRyscGK3QjlbqQ oqgz+4z7zsLgSOExzRQfnQdLtlQUxNwplf28SL36GehETpER7x5giBO2gf88Nv/1HY2eBbU4pEySs weqYCdNlqGs+UZa3DKC3zwnAojT5+AEfmnMeMD4rDpuiuWpSBlzIOLMKixEUD2cQ8Mrs+IznkTEit jm7jViFynRs8rpG1DjBOC9PxZgOS3wwht0HgNedbYVPQYmAHIX+ORZ1G8VLkl9iC8cV7PB0Tkcjxg vHPh8XS7GiS0A52rlNvyxYj7COVJppGJQCQvOCeRvUgz2OT7DHM54PcbgBovnl/fVfBBHmgsMkjnr 12to9o8eA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDVOO-00049X-Hf; Wed, 02 Sep 2020 16:13:48 +0000 Received: from vps0.lunn.ch ([185.16.172.187]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDVOM-00048l-3q for linux-arm-kernel@lists.infradead.org; Wed, 02 Sep 2020 16:13:47 +0000 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kDVO4-00Cud1-AA; Wed, 02 Sep 2020 18:13:28 +0200 Date: Wed, 2 Sep 2020 18:13:28 +0200 From: Andrew Lunn To: Pali =?iso-8859-1?Q?Roh=E1r?= Subject: Re: [PATCH 1/2] phy: marvell: comphy: Convert internal SMCC firmware return codes to errno Message-ID: <20200902161328.GE3050651@lunn.ch> References: <20200902144344.16684-1-pali@kernel.org> <20200902144344.16684-2-pali@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200902144344.16684-2-pali@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200902_121346_209472_9D075904 X-CRM114-Status: GOOD ( 18.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomasz Maciej Nowak , Rob Herring , Lorenzo Pieralisi , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kishon Vijay Abraham I , Vinod Koul , Miquel Raynal , Bjorn Helgaas , Marek =?iso-8859-1?Q?Beh=FAn?= , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Sep 02, 2020 at 04:43:43PM +0200, Pali Roh=E1r wrote: > Driver ->power_on and ->power_off callbacks leaks internal SMCC firmware > return codes to phy caller. This patch converts SMCC error codes to > standard linux errno codes. Include file linux/arm-smccc.h already provid= es > defines for SMCC error codes, so use them instead of custom driver define= s. > Note that return value is signed 32bit, but stored in unsigned long type > with zero padding. > = > Signed-off-by: Pali Roh=E1r > --- > drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 14 +++++++++++--- > drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 14 +++++++++++--- > 2 files changed, 22 insertions(+), 6 deletions(-) > = > diff --git a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c b/drivers/phy/m= arvell/phy-mvebu-a3700-comphy.c > index 1a138be8bd6a..810f25a47632 100644 > --- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c > +++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c > @@ -26,7 +26,6 @@ > #define COMPHY_SIP_POWER_ON 0x82000001 > #define COMPHY_SIP_POWER_OFF 0x82000002 > #define COMPHY_SIP_PLL_LOCK 0x82000003 > -#define COMPHY_FW_NOT_SUPPORTED (-1) > = > #define COMPHY_FW_MODE_SATA 0x1 > #define COMPHY_FW_MODE_SGMII 0x2 > @@ -112,10 +111,19 @@ static int mvebu_a3700_comphy_smc(unsigned long fun= ction, unsigned long lane, > unsigned long mode) > { > struct arm_smccc_res res; > + s32 ret; > = > arm_smccc_smc(function, lane, mode, 0, 0, 0, 0, 0, &res); > + ret =3D res.a0; > = > - return res.a0; > + switch (ret) { > + case SMCCC_RET_SUCCESS: > + return 0; > + case SMCCC_RET_NOT_SUPPORTED: > + return -EOPNOTSUPP; > + default: > + return -EINVAL; > + } > } Hi Pali Maybe this should be a global helper translating SMCCC_RET_* into a standard errno value? Andrew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel