Patchwork ahci_imx: Put #ifdef CONFIG_PM_SLEEP around suspend / resume functions

login
register
mail settings
Submitter Hans de Goede
Date March 5, 2014, 7:17 p.m.
Message ID <1394047069-29902-1-git-send-email-hdegoede@redhat.com>
Download mbox | patch
Permalink /patch/327124/
State New
Headers show

Comments

Hans de Goede - March 5, 2014, 7:17 p.m.
This fixes the following warnings when CONFIG_PM_SLEEP is not set:

drivers/ata/ahci_imx.c:284:12: warning: ‘imx_ahci_suspend’ defined but not used [-Wunused-function]
drivers/ata/ahci_imx.c:299:12: warning: ‘imx_ahci_resume’ defined but not used [-Wunused-function]

Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/ata/ahci_imx.c | 2 ++
 1 file changed, 2 insertions(+)
Marek Vasut - March 5, 2014, 7:23 p.m.
On Wednesday, March 05, 2014 at 08:17:49 PM, Hans de Goede wrote:
> This fixes the following warnings when CONFIG_PM_SLEEP is not set:
> 
> drivers/ata/ahci_imx.c:284:12: warning: ‘imx_ahci_suspend’ defined but not
> used [-Wunused-function] drivers/ata/ahci_imx.c:299:12: warning:
> ‘imx_ahci_resume’ defined but not used [-Wunused-function]
> 
> Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Obviously makes sense.

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
Alexander Shiyan - March 5, 2014, 7:27 p.m.
Среда,  5 марта 2014, 20:23 +01:00 от Marek Vasut <marex@denx.de>:
> On Wednesday, March 05, 2014 at 08:17:49 PM, Hans de Goede wrote:
> > This fixes the following warnings when CONFIG_PM_SLEEP is not set:
> > 
> > drivers/ata/ahci_imx.c:284:12: warning: ‘imx_ahci_suspend’ defined but not
> > used [-Wunused-function] drivers/ata/ahci_imx.c:299:12: warning:
> > ‘imx_ahci_resume’ defined but not used [-Wunused-function]
> > 
> > Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> > Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> Obviously makes sense.
> 
> Acked-by: Marek Vasut <marex@denx.de>

But a better way is to use the "__maybe_unused" attribute for such cases.

---
Tejun Heo - March 6, 2014, 7:31 p.m.
On Wed, Mar 05, 2014 at 08:17:49PM +0100, Hans de Goede wrote:
> This fixes the following warnings when CONFIG_PM_SLEEP is not set:
> 
> drivers/ata/ahci_imx.c:284:12: warning: ‘imx_ahci_suspend’ defined but not used [-Wunused-function]
> drivers/ata/ahci_imx.c:299:12: warning: ‘imx_ahci_resume’ defined but not used [-Wunused-function]
> 
> Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Applied to libata/for-3.15.

Thanks.

Patch

diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index 3cb5d69..497c7ab 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -281,6 +281,7 @@  static void ahci_imx_host_stop(struct ata_host *host)
 	imx_sata_disable(hpriv);
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int imx_ahci_suspend(struct device *dev)
 {
 	struct ata_host *host = dev_get_drvdata(dev);
@@ -308,6 +309,7 @@  static int imx_ahci_resume(struct device *dev)
 
 	return ahci_platform_resume_host(dev);
 }
+#endif
 
 static SIMPLE_DEV_PM_OPS(ahci_imx_pm_ops, imx_ahci_suspend, imx_ahci_resume);