diff options
-rw-r--r-- | drivers/rtc/rtc-generic.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c index e782ebd719b2..d726c6aa96a8 100644 --- a/drivers/rtc/rtc-generic.c +++ b/drivers/rtc/rtc-generic.c | |||
@@ -9,6 +9,8 @@ | |||
9 | #include <linux/platform_device.h> | 9 | #include <linux/platform_device.h> |
10 | #include <linux/rtc.h> | 10 | #include <linux/rtc.h> |
11 | 11 | ||
12 | #if defined(CONFIG_M68K) || defined(CONFIG_PARISC) || \ | ||
13 | defined(CONFIG_PPC) || defined(CONFIG_SUPERH32) | ||
12 | #include <asm/rtc.h> | 14 | #include <asm/rtc.h> |
13 | 15 | ||
14 | static int generic_get_time(struct device *dev, struct rtc_time *tm) | 16 | static int generic_get_time(struct device *dev, struct rtc_time *tm) |
@@ -33,13 +35,21 @@ static const struct rtc_class_ops generic_rtc_ops = { | |||
33 | .read_time = generic_get_time, | 35 | .read_time = generic_get_time, |
34 | .set_time = generic_set_time, | 36 | .set_time = generic_set_time, |
35 | }; | 37 | }; |
38 | #else | ||
39 | #define generic_rtc_ops *(struct rtc_class_ops*)NULL | ||
40 | #endif | ||
36 | 41 | ||
37 | static int __init generic_rtc_probe(struct platform_device *dev) | 42 | static int __init generic_rtc_probe(struct platform_device *dev) |
38 | { | 43 | { |
39 | struct rtc_device *rtc; | 44 | struct rtc_device *rtc; |
45 | const struct rtc_class_ops *ops; | ||
46 | |||
47 | ops = dev_get_platdata(&dev->dev); | ||
48 | if (!ops) | ||
49 | ops = &generic_rtc_ops; | ||
40 | 50 | ||
41 | rtc = devm_rtc_device_register(&dev->dev, "rtc-generic", | 51 | rtc = devm_rtc_device_register(&dev->dev, "rtc-generic", |
42 | &generic_rtc_ops, THIS_MODULE); | 52 | ops, THIS_MODULE); |
43 | if (IS_ERR(rtc)) | 53 | if (IS_ERR(rtc)) |
44 | return PTR_ERR(rtc); | 54 | return PTR_ERR(rtc); |
45 | 55 | ||