brcm2708: Add support for raspberry pi 3 b+.
[openwrt/staging/wigyori.git] / target / linux / bcm53xx / patches-4.4 / 083-0005-spi-bcm-qspi-fix-suspend-resume-ifdef.patch
1 From a0319f8b12c0fb9800da61f4cba9bd6fd80e37a4 Mon Sep 17 00:00:00 2001
2 From: Arnd Bergmann <arnd@arndb.de>
3 Date: Thu, 15 Sep 2016 17:46:53 +0200
4 Subject: [PATCH] spi: bcm-qspi: fix suspend/resume #ifdef
5
6 The two power management functions are define inside of an #ifdef
7 but referenced unconditionally, which is obviously broken when
8 CONFIG_PM_SLEEP is not set:
9
10 drivers/spi/spi-bcm-qspi.c:1300:13: error: 'bcm_qspi_suspend' undeclared here (not in a function)
11 drivers/spi/spi-bcm-qspi.c:1301:13: error: 'bcm_qspi_resume' undeclared here (not in a function)
12
13 This replaces the #ifdef with a __maybe_unused annotation that lets
14 the compiler figure out whether to drop the functions itself,
15 and uses SIMPLE_DEV_PM_OPS() to refer to the functions.
16
17 This will also fill the freeze/thaw/poweroff/restore callback
18 pointers in addition to suspend/resume, but as far as I can tell,
19 this is what we want.
20
21 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
22 Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver")
23 Signed-off-by: Mark Brown <broonie@kernel.org>
24 ---
25 drivers/spi/spi-bcm-qspi.c | 12 ++++--------
26 1 file changed, 4 insertions(+), 8 deletions(-)
27
28 --- a/drivers/spi/spi-bcm-qspi.c
29 +++ b/drivers/spi/spi-bcm-qspi.c
30 @@ -1268,8 +1268,7 @@ int bcm_qspi_remove(struct platform_devi
31 /* function to be called by SoC specific platform driver remove() */
32 EXPORT_SYMBOL_GPL(bcm_qspi_remove);
33
34 -#ifdef CONFIG_PM_SLEEP
35 -static int bcm_qspi_suspend(struct device *dev)
36 +static int __maybe_unused bcm_qspi_suspend(struct device *dev)
37 {
38 struct bcm_qspi *qspi = dev_get_drvdata(dev);
39
40 @@ -1280,7 +1279,7 @@ static int bcm_qspi_suspend(struct devic
41 return 0;
42 };
43
44 -static int bcm_qspi_resume(struct device *dev)
45 +static int __maybe_unused bcm_qspi_resume(struct device *dev)
46 {
47 struct bcm_qspi *qspi = dev_get_drvdata(dev);
48 int ret = 0;
49 @@ -1293,12 +1292,9 @@ static int bcm_qspi_resume(struct device
50
51 return ret;
52 }
53 -#endif /* CONFIG_PM_SLEEP */
54
55 -const struct dev_pm_ops bcm_qspi_pm_ops = {
56 - .suspend = bcm_qspi_suspend,
57 - .resume = bcm_qspi_resume,
58 -};
59 +SIMPLE_DEV_PM_OPS(bcm_qspi_pm_ops, bcm_qspi_suspend, bcm_qspi_resume);
60 +
61 /* pm_ops to be called by SoC specific platform driver */
62 EXPORT_SYMBOL_GPL(bcm_qspi_pm_ops);
63