Skip to content

Commit 26a526c

Browse files
arndbandersson
authored andcommitted
soc: qcom: spm: fix building with CONFIG_REGULATOR=n
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: 6496dba ("soc: qcom: spm: add support for voltage regulator") Signed-off-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent aa05f47 commit 26a526c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/soc/qcom/spm.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ static int spm_get_cpu(struct device *dev)
411411
return -EOPNOTSUPP;
412412
}
413413

414-
#ifdef CONFIG_REGULATOR
415414
static int spm_register_regulator(struct device *dev, struct spm_driver_data *drv)
416415
{
417416
struct regulator_config config = {
@@ -474,12 +473,6 @@ static int spm_register_regulator(struct device *dev, struct spm_driver_data *dr
474473

475474
return 0;
476475
}
477-
#else
478-
static int spm_register_regulator(struct device *dev, struct spm_driver_data *drv)
479-
{
480-
return 0;
481-
}
482-
#endif
483476

484477
static const struct of_device_id spm_match_table[] = {
485478
{ .compatible = "qcom,sdm660-gold-saw2-v4.1-l2",
@@ -559,7 +552,10 @@ static int spm_dev_probe(struct platform_device *pdev)
559552
if (drv->reg_data->reg_offset[SPM_REG_SPM_CTL])
560553
spm_set_low_power_mode(drv, PM_SLEEP_MODE_STBY);
561554

562-
return spm_register_regulator(&pdev->dev, drv);
555+
if (IS_ENABLED(CONFIG_REGULATOR))
556+
return spm_register_regulator(&pdev->dev, drv);
557+
558+
return 0;
563559
}
564560

565561
static struct platform_driver spm_driver = {

0 commit comments

Comments
 (0)