[PATCH 4/6] staging: media: atomisp: fix build when PM is disabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The function atomisp_restore_iumit_reg is unused when PM is disabled.
Adding __maybe_unused to the function definition avoids a warning.

During a reset (atomisp_reset), PM functions atomisp_runtime_suspend,
atomisp_mrfld_power_down, atomisp_mrfld_power_up and
atomisp_runtime_resume should be called only if PM is enabled.

Same thing apply in atomisp_pci_probe: atomis_mrfld_power_down should be
called only if PM is enabled.

Signed-off-by: Jérémy Lefaure <jeremy.lefaure@xxxxxxxxxxxx>
---
 .../media/atomisp/pci/atomisp2/atomisp_cmd.c       | 30 +++++++++++++---------
 .../media/atomisp/pci/atomisp2/atomisp_v4l2.c      |  4 +--
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index 1ee99d0..38e4bb3 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -358,20 +358,26 @@ int atomisp_reset(struct atomisp_device *isp)
 
 	dev_dbg(isp->dev, "%s\n", __func__);
 	atomisp_css_suspend(isp);
-	ret = atomisp_runtime_suspend(isp->dev);
-	if (ret < 0)
-		dev_err(isp->dev, "atomisp_runtime_suspend failed, %d\n", ret);
-	ret = atomisp_mrfld_power_down(isp);
-	if (ret < 0) {
-		dev_err(isp->dev, "can not disable ISP power\n");
-	} else {
-		ret = atomisp_mrfld_power_up(isp);
-		if (ret < 0)
-			dev_err(isp->dev, "can not enable ISP power\n");
-		ret = atomisp_runtime_resume(isp->dev);
+
+	if (IS_ENABLED(CONFI_PM)) {
+		ret = atomisp_runtime_suspend(isp->dev);
 		if (ret < 0)
-			dev_err(isp->dev, "atomisp_runtime_resume failed, %d\n", ret);
+			dev_err(isp->dev, "atomisp_runtime_suspend failed, %d\n",
+				ret);
+		ret = atomisp_mrfld_power_down(isp);
+		if (ret < 0) {
+			dev_err(isp->dev, "can not disable ISP power\n");
+		} else {
+			ret = atomisp_mrfld_power_up(isp);
+			if (ret < 0)
+				dev_err(isp->dev, "can not enable ISP power\n");
+			ret = atomisp_runtime_resume(isp->dev);
+			if (ret < 0)
+				dev_err(isp->dev, "atomisp_runtime_resume failed, %d\n",
+					ret);
+		}
 	}
+
 	ret = atomisp_css_resume(isp);
 	if (ret)
 		isp->isp_fatal_error = true;
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
index 755c27c..cd56840 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
@@ -264,7 +264,7 @@ static int atomisp_save_iunit_reg(struct atomisp_device *isp)
 	return 0;
 }
 
-static int atomisp_restore_iunit_reg(struct atomisp_device *isp)
+static int __maybe_unused atomisp_restore_iunit_reg(struct atomisp_device *isp)
 {
 	struct pci_dev *dev = isp->pdev;
 
@@ -1526,7 +1526,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	atomisp_ospm_dphy_down(isp);
 
 	/* Address later when we worry about the ...field chips */
-	if (atomisp_mrfld_power_down(isp))
+	if (IS_ENABLED(CONFIG_PM) && atomisp_mrfld_power_down(isp))
 		dev_err(&dev->dev, "Failed to switch off ISP\n");
 	pci_dev_put(isp->pci_root);
 	return err;
-- 
2.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux