From patchwork Wed Feb 21 15:44:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 204270 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1119072dyc; Wed, 21 Feb 2024 07:45:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVz1wxQuaMdRiI8ZslyEQZzdD5mng3NcVzTPUbYhcQ4II25vNqWl5qjxP24aKAOB2mrrd5j7rm+rwhYenghEeMS0KcKlw== X-Google-Smtp-Source: AGHT+IFbzVTvEGNEk11hssw7Wly4FfXJOtTL1nkTrNTj3jy8kvYvD+gHWoeHTdYjVVgXDJwmKVPh X-Received: by 2002:a17:906:2b07:b0:a3f:3c26:b250 with SMTP id a7-20020a1709062b0700b00a3f3c26b250mr1356843ejg.40.1708530337152; Wed, 21 Feb 2024 07:45:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708530337; cv=pass; d=google.com; s=arc-20160816; b=lA+uf4YHr8jZMAN7xI6LjsQBLd5/1/GS1rGUBYaXtnvQXMm6t6HTZtQ3qCsK7I7MlC EM5JYF3xWPOYQXuVEFBfNLAmlp73+YmxdkmB69fUXWzluZLaag4sxAdJSaj2vlubvOeH pet3C7+91+QulUJ4yoeF3aqX8A7A2zJQFQ2dJyUx6G6yQd4r5JE+vf3ygy1GHAnJa7nC Wn6YDAOOYwCpX6eLgUuXfRpQz2BRLY0qrWtGTfWm/UvXRpvFbD0s7MvMWISzNO/dw79B /IURcF2Hs9acofQxcAMXRG6TGGy2TJS2+wz4E/7aM88tZCQ1I+r3mbEITspQRKJMwcfU chUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=SI1ezihDKLiqQR0oSSQwGQOSY710lHqadRw+865i/Q4=; fh=Lm538IuyHnlQ8pqnGR5BRzYVkT81yWAX9PdayVn9TUs=; b=r/JMQkPBBNQB1hNUIHpsDCqmDW2lXu/lM7jRVWzjunY2ZaKWuYvsSM3yrrLar1zKJt ghv8ZqtOkqbMHJ01LTXnNlbDEfY7tSMTfJ5fGz5OdiPvMIsLnxB5hcJ+VOh3d04eHQNy pE0qBgUzDZWorBNzwF92pC6KnfMdt6HBxIKq8+33Ikj1otwjXDK5KAi64MkcuKSB6rxO Ic1eGgM5sgIwz/3dBoBfWusvzMRkTwuiwNdvoZT1IvVrOIvMEUEWaZfVf88UR/0nE8Vg bbURaVVgRrF3r+KEKnSCxQYaNSyS5ywaN5DKrUnpPW9zQL++XPpM33Wl7tm1KQ91ghhn muaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=inS2MZoI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-75020-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75020-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k5-20020a1709061c0500b00a3f4f9260b1si429550ejg.366.2024.02.21.07.45.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 07:45:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75020-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=inS2MZoI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-75020-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75020-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BEBA81F25615 for ; Wed, 21 Feb 2024 15:45:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DEFCB8120F; Wed, 21 Feb 2024 15:45:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="inS2MZoI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59B588060B; Wed, 21 Feb 2024 15:45:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708530303; cv=none; b=oCRT9rHfZBOYqvbWgskL/dp+frsxXTRf5pFxMZXa2FEHiO3yh0s5ifLA+z7AMZkt2Amp6m/MF2aAC/N1FT5Dg2c7mYBZWpoqFZ8mnEqqXpR+KOXZEZ7ipFQpkQHrh9RJATNrBjnFgxgw/qI4BOCxZlOh+1EwD6UXHVrvPvod6yI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708530303; c=relaxed/simple; bh=Dx1Syz9O7J+YAvuPHu3WZWipG8gNA1k5VFmM93qyay0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=f3BNrN+R112FhM2bHye12Px2+ozZyKUPWv01RUeUoewxfbIiNrsKOUd2+vuqBrn+5XWY/LIAVyufw3MKWF9zql/k7HoPTzD5aHpXgwP59PsdmgdWM7NXsS8/3bKhOjBuw82cVYPWLNKXMiiiFMUWMpyBxsueNUrmILc/SgpHz1c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=inS2MZoI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05F0EC43142; Wed, 21 Feb 2024 15:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708530302; bh=Dx1Syz9O7J+YAvuPHu3WZWipG8gNA1k5VFmM93qyay0=; h=From:To:Cc:Subject:Date:From; b=inS2MZoI7gFXzSn1OqaDYssIZN6F+jKDv0klzkkRDqjzr1Eid3oa1ab8ohcoq7RHl Ph/53TomNjZqyH/2+MJyw6w6r+vJyEB6H1dVH61lizDeZOD0R8MPh1PDRFYbQ2ubrE //Sr6E2bjoFqGp1iM5t7kSkr/lyBMOnIRtNFD1WyErTmUbx7yYiUnoCyzpH50yMYnO BbUREfBcFRGeWi34XfuyED1VwAbs+m8QLHHp9INeKs4zbx+8VcVdWdHOVmuRMEItML 17u4UUbPksP9Q2kWvyM4XoexTdehAa1ZqL5ZKoRIVKxr9RuMpSHhJjMY/cMRSKWamG VYtLGZXxJEwhw== From: Arnd Bergmann To: Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov Cc: Arnd Bergmann , Rob Herring , Yangtao Li , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] soc: qcom: spm: fix building with CONFIG_REGULATOR=n Date: Wed, 21 Feb 2024 16:44:51 +0100 Message-Id: <20240221154457.2007420-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791523906871889715 X-GMAIL-MSGID: 1791523906871889715 From: Arnd Bergmann The newly added code causes a build failure when -Werror is set: drivers/soc/qcom/spm.c:388:12: error: 'spm_get_cpu' defined but not used [-Werror=unused-function] Remove the #ifdef and instead use an IS_ENABLED() check that lets the compiler perform dead code elimination instead of the preprocessor. Fixes: 6496dba142f4 ("soc: qcom: spm: add support for voltage regulator") Signed-off-by: Arnd Bergmann --- drivers/soc/qcom/spm.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/soc/qcom/spm.c b/drivers/soc/qcom/spm.c index 5eefaec72a13..06e2c4c2a4a8 100644 --- a/drivers/soc/qcom/spm.c +++ b/drivers/soc/qcom/spm.c @@ -411,7 +411,6 @@ static int spm_get_cpu(struct device *dev) return -EOPNOTSUPP; } -#ifdef CONFIG_REGULATOR static int spm_register_regulator(struct device *dev, struct spm_driver_data *drv) { struct regulator_config config = { @@ -474,12 +473,6 @@ static int spm_register_regulator(struct device *dev, struct spm_driver_data *dr return 0; } -#else -static int spm_register_regulator(struct device *dev, struct spm_driver_data *drv) -{ - return 0; -} -#endif static const struct of_device_id spm_match_table[] = { { .compatible = "qcom,sdm660-gold-saw2-v4.1-l2", @@ -559,7 +552,10 @@ static int spm_dev_probe(struct platform_device *pdev) if (drv->reg_data->reg_offset[SPM_REG_SPM_CTL]) spm_set_low_power_mode(drv, PM_SLEEP_MODE_STBY); - return spm_register_regulator(&pdev->dev, drv); + if (IS_ENABLED(CONFIG_REGULATOR)) + return spm_register_regulator(&pdev->dev, drv); + + return 0; } static struct platform_driver spm_driver = {