diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-02 18:55:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-02 18:55:43 -0500 |
commit | e6d9f0fb5f9ceca5f4945f12cd3e71efd3382c13 (patch) | |
tree | 04435004a39c68d335557bbe77f06153cdf9d709 | |
parent | e1825e7515010053e44287e6e78f9078cd1916a9 (diff) | |
parent | b270ee8a9fc9547eb781ce9ccd379450bcf9a204 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
sparc64: Fix offset calculation in compute_size()
rtc: rtc-starfire fixes
-rw-r--r-- | arch/sparc64/lib/user_fixup.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-starfire.c | 66 |
2 files changed, 14 insertions, 54 deletions
diff --git a/arch/sparc64/lib/user_fixup.c b/arch/sparc64/lib/user_fixup.c index 19d1fdb17d0e..05a361b0a1a4 100644 --- a/arch/sparc64/lib/user_fixup.c +++ b/arch/sparc64/lib/user_fixup.c | |||
@@ -24,7 +24,7 @@ static unsigned long compute_size(unsigned long start, unsigned long size, unsig | |||
24 | if (fault_addr < start || fault_addr >= end) { | 24 | if (fault_addr < start || fault_addr >= end) { |
25 | *offset = 0; | 25 | *offset = 0; |
26 | } else { | 26 | } else { |
27 | *offset = start - fault_addr; | 27 | *offset = fault_addr - start; |
28 | size = end - fault_addr; | 28 | size = end - fault_addr; |
29 | } | 29 | } |
30 | return size; | 30 | return size; |
diff --git a/drivers/rtc/rtc-starfire.c b/drivers/rtc/rtc-starfire.c index 7ccb0dd700af..5be98bfd7ed3 100644 --- a/drivers/rtc/rtc-starfire.c +++ b/drivers/rtc/rtc-starfire.c | |||
@@ -6,7 +6,6 @@ | |||
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/time.h> | ||
10 | #include <linux/rtc.h> | 9 | #include <linux/rtc.h> |
11 | #include <linux/platform_device.h> | 10 | #include <linux/platform_device.h> |
12 | 11 | ||
@@ -16,11 +15,6 @@ MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); | |||
16 | MODULE_DESCRIPTION("Starfire RTC driver"); | 15 | MODULE_DESCRIPTION("Starfire RTC driver"); |
17 | MODULE_LICENSE("GPL"); | 16 | MODULE_LICENSE("GPL"); |
18 | 17 | ||
19 | struct starfire_rtc { | ||
20 | struct rtc_device *rtc; | ||
21 | spinlock_t lock; | ||
22 | }; | ||
23 | |||
24 | static u32 starfire_get_time(void) | 18 | static u32 starfire_get_time(void) |
25 | { | 19 | { |
26 | static char obp_gettod[32]; | 20 | static char obp_gettod[32]; |
@@ -35,64 +29,31 @@ static u32 starfire_get_time(void) | |||
35 | 29 | ||
36 | static int starfire_read_time(struct device *dev, struct rtc_time *tm) | 30 | static int starfire_read_time(struct device *dev, struct rtc_time *tm) |
37 | { | 31 | { |
38 | struct starfire_rtc *p = dev_get_drvdata(dev); | 32 | rtc_time_to_tm(starfire_get_time(), tm); |
39 | unsigned long flags, secs; | 33 | return rtc_valid_tm(tm); |
40 | |||
41 | spin_lock_irqsave(&p->lock, flags); | ||
42 | secs = starfire_get_time(); | ||
43 | spin_unlock_irqrestore(&p->lock, flags); | ||
44 | |||
45 | rtc_time_to_tm(secs, tm); | ||
46 | |||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | static int starfire_set_time(struct device *dev, struct rtc_time *tm) | ||
51 | { | ||
52 | unsigned long secs; | ||
53 | int err; | ||
54 | |||
55 | err = rtc_tm_to_time(tm, &secs); | ||
56 | if (err) | ||
57 | return err; | ||
58 | |||
59 | /* Do nothing, time is set using the service processor | ||
60 | * console on this platform. | ||
61 | */ | ||
62 | return 0; | ||
63 | } | 34 | } |
64 | 35 | ||
65 | static const struct rtc_class_ops starfire_rtc_ops = { | 36 | static const struct rtc_class_ops starfire_rtc_ops = { |
66 | .read_time = starfire_read_time, | 37 | .read_time = starfire_read_time, |
67 | .set_time = starfire_set_time, | ||
68 | }; | 38 | }; |
69 | 39 | ||
70 | static int __devinit starfire_rtc_probe(struct platform_device *pdev) | 40 | static int __init starfire_rtc_probe(struct platform_device *pdev) |
71 | { | 41 | { |
72 | struct starfire_rtc *p = kzalloc(sizeof(*p), GFP_KERNEL); | 42 | struct rtc_device *rtc = rtc_device_register("starfire", &pdev->dev, |
73 | 43 | &starfire_rtc_ops, THIS_MODULE); | |
74 | if (!p) | 44 | if (IS_ERR(rtc)) |
75 | return -ENOMEM; | 45 | return PTR_ERR(rtc); |
76 | 46 | ||
77 | spin_lock_init(&p->lock); | 47 | platform_set_drvdata(pdev, rtc); |
78 | 48 | ||
79 | p->rtc = rtc_device_register("starfire", &pdev->dev, | ||
80 | &starfire_rtc_ops, THIS_MODULE); | ||
81 | if (IS_ERR(p->rtc)) { | ||
82 | int err = PTR_ERR(p->rtc); | ||
83 | kfree(p); | ||
84 | return err; | ||
85 | } | ||
86 | platform_set_drvdata(pdev, p); | ||
87 | return 0; | 49 | return 0; |
88 | } | 50 | } |
89 | 51 | ||
90 | static int __devexit starfire_rtc_remove(struct platform_device *pdev) | 52 | static int __exit starfire_rtc_remove(struct platform_device *pdev) |
91 | { | 53 | { |
92 | struct starfire_rtc *p = platform_get_drvdata(pdev); | 54 | struct rtc_device *rtc = platform_get_drvdata(pdev); |
93 | 55 | ||
94 | rtc_device_unregister(p->rtc); | 56 | rtc_device_unregister(rtc); |
95 | kfree(p); | ||
96 | 57 | ||
97 | return 0; | 58 | return 0; |
98 | } | 59 | } |
@@ -102,13 +63,12 @@ static struct platform_driver starfire_rtc_driver = { | |||
102 | .name = "rtc-starfire", | 63 | .name = "rtc-starfire", |
103 | .owner = THIS_MODULE, | 64 | .owner = THIS_MODULE, |
104 | }, | 65 | }, |
105 | .probe = starfire_rtc_probe, | 66 | .remove = __exit_p(starfire_rtc_remove), |
106 | .remove = __devexit_p(starfire_rtc_remove), | ||
107 | }; | 67 | }; |
108 | 68 | ||
109 | static int __init starfire_rtc_init(void) | 69 | static int __init starfire_rtc_init(void) |
110 | { | 70 | { |
111 | return platform_driver_register(&starfire_rtc_driver); | 71 | return platform_driver_probe(&starfire_rtc_driver, starfire_rtc_probe); |
112 | } | 72 | } |
113 | 73 | ||
114 | static void __exit starfire_rtc_exit(void) | 74 | static void __exit starfire_rtc_exit(void) |