From patchwork Thu Jan 26 18:05:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 13117568 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52C3DC61DA3 for ; Thu, 26 Jan 2023 18:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Cc3aybJsaY7qA1BCdnWmg1yUjyHjQgU23MaH/nEm9Fc=; b=VFr0vuTObwEwgs rcSf6iyDeh//uf3lypoi6RRskKa4sUcfmMBA98nmKepYQ/KFhXUQVFC6We9tnJPE/udk7EIO0axiv uyg2CsF1XAguKAJ8KpOGrrU1XGsoan1BmYRVa2lygN+cMHNCnAQGiELRe6fT5G03/5vG85RHlyqQc oyqBR2u3loBdzcmex/KL1bjXfX8pLphLxPMi4KaCgA1dWyGcn24NMJGgGoLsRTjz9Ui35/DxLXhEy 4F1v2z1ZOTQi2E3rbkv5/0xUiCPg3LyxGqOEp9tpJg4DJDbvl3JWzrUtq0NkAEwmyRHrNYaFN5wVP 4mqSzcpm9UinGToljPKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pL6dB-00C6yK-5u; Thu, 26 Jan 2023 18:05:49 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pL6d7-00C6ww-Ga for linux-arm-kernel@lists.infradead.org; Thu, 26 Jan 2023 18:05:47 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E5E304B3; Thu, 26 Jan 2023 10:06:19 -0800 (PST) Received: from e120937-lin.. (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D600B3F71E; Thu, 26 Jan 2023 10:05:36 -0800 (PST) From: Cristian Marussi To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: sudeep.holla@arm.com, Cristian Marussi , Mark Brown , Jim Quinlan , Florian Fainelli Subject: [PATCH] regulator: scmi: Allow for zero voltage domains Date: Thu, 26 Jan 2023 18:05:11 +0000 Message-Id: <20230126180511.766373-1-cristian.marussi@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230126_100545_639611_B124BE55 X-CRM114-Status: GOOD ( 11.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org SCMI Voltage protocol allows the platform to report no voltage domains on discovery, while warning the user about such an odd configuration. As a consequence this condition should not be treated as error by the SCMI regulator driver either. Allow SCMI regulator driver to probe successfully even when no voltage domains are discovered. Cc: Mark Brown Cc: Jim Quinlan Cc: Florian Fainelli Fixes: 0fbeae70ee7c ("regulator: add SCMI driver") Signed-off-by: Cristian Marussi --- drivers/regulator/scmi-regulator.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c index b9918f4fd241..29ab217297d6 100644 --- a/drivers/regulator/scmi-regulator.c +++ b/drivers/regulator/scmi-regulator.c @@ -311,16 +311,12 @@ static int scmi_regulator_probe(struct scmi_device *sdev) return PTR_ERR(voltage_ops); num_doms = voltage_ops->num_domains_get(ph); - if (num_doms <= 0) { - if (!num_doms) { - dev_err(&sdev->dev, - "number of voltage domains invalid\n"); - num_doms = -EINVAL; - } else { - dev_err(&sdev->dev, - "failed to get voltage domains - err:%d\n", - num_doms); - } + if (!num_doms) + return 0; + + if (num_doms < 0) { + dev_err(&sdev->dev, "failed to get voltage domains - err:%d\n", + num_doms); return num_doms; }