27ee1b6d1980a2c8cc2bb9fc013eeb9a51512904
[openwrt/openwrt.git] / target / linux / at91 / patches-5.15 / 191-i2c-at91-remove-define-CONFIG_PM.patch
1 From 023a6b46536dce41f2c5a7425826fc4da4509b8f Mon Sep 17 00:00:00 2001
2 From: Claudiu Beznea <claudiu.beznea@microchip.com>
3 Date: Mon, 5 Jul 2021 15:15:16 +0300
4 Subject: [PATCH 191/247] i2c: at91: remove #define CONFIG_PM
5
6 Remove #define CONFIG_PM and use __maybe_unused for PM functions and
7 pm_ptr() for PM ops.
8
9 Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
10 Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
11 Signed-off-by: Wolfram Sang <wsa@kernel.org>
12 ---
13 drivers/i2c/busses/i2c-at91-core.c | 17 +++++------------
14 1 file changed, 5 insertions(+), 12 deletions(-)
15
16 --- a/drivers/i2c/busses/i2c-at91-core.c
17 +++ b/drivers/i2c/busses/i2c-at91-core.c
18 @@ -286,9 +286,7 @@ static int at91_twi_remove(struct platfo
19 return 0;
20 }
21
22 -#ifdef CONFIG_PM
23 -
24 -static int at91_twi_runtime_suspend(struct device *dev)
25 +static int __maybe_unused at91_twi_runtime_suspend(struct device *dev)
26 {
27 struct at91_twi_dev *twi_dev = dev_get_drvdata(dev);
28
29 @@ -299,7 +297,7 @@ static int at91_twi_runtime_suspend(stru
30 return 0;
31 }
32
33 -static int at91_twi_runtime_resume(struct device *dev)
34 +static int __maybe_unused at91_twi_runtime_resume(struct device *dev)
35 {
36 struct at91_twi_dev *twi_dev = dev_get_drvdata(dev);
37
38 @@ -308,7 +306,7 @@ static int at91_twi_runtime_resume(struc
39 return clk_prepare_enable(twi_dev->clk);
40 }
41
42 -static int at91_twi_suspend_noirq(struct device *dev)
43 +static int __maybe_unused at91_twi_suspend_noirq(struct device *dev)
44 {
45 if (!pm_runtime_status_suspended(dev))
46 at91_twi_runtime_suspend(dev);
47 @@ -316,7 +314,7 @@ static int at91_twi_suspend_noirq(struct
48 return 0;
49 }
50
51 -static int at91_twi_resume_noirq(struct device *dev)
52 +static int __maybe_unused at91_twi_resume_noirq(struct device *dev)
53 {
54 struct at91_twi_dev *twi_dev = dev_get_drvdata(dev);
55 int ret;
56 @@ -342,11 +340,6 @@ static const struct dev_pm_ops at91_twi_
57 .runtime_resume = at91_twi_runtime_resume,
58 };
59
60 -#define at91_twi_pm_ops (&at91_twi_pm)
61 -#else
62 -#define at91_twi_pm_ops NULL
63 -#endif
64 -
65 static struct platform_driver at91_twi_driver = {
66 .probe = at91_twi_probe,
67 .remove = at91_twi_remove,
68 @@ -354,7 +347,7 @@ static struct platform_driver at91_twi_d
69 .driver = {
70 .name = "at91_i2c",
71 .of_match_table = of_match_ptr(atmel_twi_dt_ids),
72 - .pm = at91_twi_pm_ops,
73 + .pm = pm_ptr(&at91_twi_pm),
74 },
75 };
76