rtc-parisc cleanup
Subsystems (2)
cover rtc-parisc cleanup
I recently submitted an rtc-efi driver having used rtc-parisc as a template. I received several suggestions from Alessandro Zummo and Andrew Morton that also apply to rtc-parisc. This series merges the relevant changes back into the rtc-parisc driver.
dann frazier (9):
Add a missing include for linux/rtc.h
Remove redundant locking
remove struct parisc_rtc
Use rtc_valid_tm() in parisc_get_time
Use platform_driver_probe
declare rtc_parisc_dev as static
remove unnecessary ret variable
remove a couple unnecessary variables
rename p pointer to rtc
arch/parisc/kernel/time.c | 7 +---- drivers/rtc/rtc-parisc.c | 56 ++++++++++++--------------------------------- 2 files changed, 17 insertions(+), 46 deletions(-)
PATCH 1/9 Add a missing include for linux/rtc.h
--- drivers/rtc/rtc-parisc.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/rtc/rtc-parisc.c +1 -0
@@ -7,6 +7,7 @@#include <linux/module.h> #include <linux/time.h> #include <linux/platform_device.h> +#include <linux/rtc.h> #include <asm/rtc.h>
Signature · 1 line
1.5.6.5
PATCH 2/9 Remove redundant locking
The RTC subsystem proides ops locking, no need to implement our own
--- drivers/rtc/rtc-parisc.c | 12 +----------- 1 files changed, 1 insertions(+), 11 deletions(-)
drivers/rtc/rtc-parisc.c +1 -10
@@ -14,17 +14,13 @@/* as simple as can be, and no simpler. */ struct parisc_rtc {struct rtc_device *rtc; -spinlock_t lock; };static int parisc_get_time (struct device *dev,struct rtc_time *tm) { -struct parisc_rtc *p =dev_get_drvdata (dev); -unsigned long flags, ret; +unsigned long ret; -spin_lock_irqsave (&p->lock, flags); ret =get_rtc_time (tm); -spin_unlock_irqrestore (&p->lock, flags);if (ret &RTC_BATT_BAD )return -EOPNOTSUPP ;
@@ -34,13 +30,9 @@ static int parisc_get_time(struct device *dev, struct rtc_time *tm)static int parisc_set_time (struct device *dev,struct rtc_time *tm) { -struct parisc_rtc *p =dev_get_drvdata (dev); -unsigned long flags;int ret; -spin_lock_irqsave (&p->lock, flags); ret =set_rtc_time (tm); -spin_unlock_irqrestore (&p->lock, flags);if (ret <0 )return -EOPNOTSUPP ;
@@ -61,8 +53,6 @@ static int __devinit parisc_rtc_probe(struct platform_device *dev)if (!p)return -ENOMEM ; -spin_lock_init (&p->lock);
PATCH 3/9 remove struct parisc_rtc
parisc_rtc now only includes an rtc_device pointer, so let's just use the rtc_device type directly.
--- drivers/rtc/rtc-parisc.c | 19 +++++++------------ 1 files changed, 7 insertions(+), 12 deletions(-)
drivers/rtc/rtc-parisc.c +7 -12
@@ -11,11 +11,6 @@#include <asm/rtc.h> -/* as simple as can be, and no simpler. */ -struct parisc_rtc { -struct rtc_device *rtc; -}; -static int parisc_get_time (struct device *dev,struct rtc_time *tm) {unsigned long ret;
@@ -47,16 +42,16 @@ static const struct rtc_class_ops parisc_rtc_ops = {static int __devinit parisc_rtc_probe (struct platform_device *dev) { -struct parisc_rtc *p; +struct rtc_device *p; p =kzalloc (sizeof (*p),GFP_KERNEL );if (!p)return -ENOMEM ; - p->rtc =rtc_device_register ("rtc-parisc" , &dev->dev, &parisc_rtc_ops, -THIS_MODULE ); -if (IS_ERR (p->rtc)) { -int err =PTR_ERR (p->rtc); + p =rtc_device_register ("rtc-parisc" , &dev->dev, &parisc_rtc_ops, +THIS_MODULE ); +if (IS_ERR (p)) { +int err =PTR_ERR (p);kfree (p);return err; }
@@ -68,9 +63,9 @@ static int __devinit parisc_rtc_probe(struct platform_device *dev) static int __devexit parisc_rtc_remove(struct platform_device *dev) { -struct parisc_rtc *p =platform_get_drvdata (dev); +struct rtc_device *p =platform_get_drvdata (dev); -rtc_device_unregister (p->rtc); +rtc_device_unregister (p);kfree (p);return 0 ;
Signature · 1 line
1.5.6.5
PATCH 4/9 Use rtc_valid_tm() in parisc_get_time
Use the return value of rtc_valid_tm() instead of just returning 0.
--- drivers/rtc/rtc-parisc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/rtc/rtc-parisc.c +1 -1
@@ -20,7 +20,7 @@ static int parisc_get_time(struct device *dev, struct rtc_time *tm)if (ret &RTC_BATT_BAD )return -EOPNOTSUPP ; -return 0 ; +return rtc_valid_tm (tm); }static int parisc_set_time (struct device *dev,struct rtc_time *tm)
Signature · 1 line
1.5.6.5
PATCH 5/9 Use platform_driver_probe
This isn't a hotpluggable device, so call platform_driver_probe directly in parisc_rtc_init
--- drivers/rtc/rtc-parisc.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-)
drivers/rtc/rtc-parisc.c +3 -9
@@ -40,19 +40,14 @@ static const struct rtc_class_ops parisc_rtc_ops = { .set_time = parisc_set_time, }; -static int __devinit parisc_rtc_probe (struct platform_device *dev) +static int __init parisc_rtc_probe (struct platform_device *dev) {struct rtc_device *p; - p =kzalloc (sizeof (*p),GFP_KERNEL ); -if (!p) -return -ENOMEM ; - p =rtc_device_register ("rtc-parisc" , &dev->dev, &parisc_rtc_ops,THIS_MODULE );if (IS_ERR (p)) {int err =PTR_ERR (p); -kfree (p);return err; }
@@ -61,12 +56,11 @@ static int __devinit parisc_rtc_probe(struct platform_device *dev)return 0 ; } -static int __devexit parisc_rtc_remove(struct platform_device *dev) +static int __exit parisc_rtc_remove(struct platform_device *dev) {struct rtc_device *p =platform_get_drvdata (dev);rtc_device_unregister (p); -kfree (p);return 0 ; }
@@ -82,7 +76,7 @@ static struct platform_driver parisc_rtc_driver = {static int __init parisc_rtc_init (void ) { -return platform_driver_register (&parisc_rtc_driver); +return platform_driver_probe (&parisc_rtc_driver, parisc_rtc_probe); } static void __exit parisc_rtc_fini(void)
Signature · 1 line
1.5.6.5
PATCH 6/9 declare rtc_parisc_dev as static
--- arch/parisc/kernel/time.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/parisc/kernel/time.c +1 -1
@@ -216,7 +216,7 @@ void __init start_cpu_itimer(void)per_cpu (cpu_data, cpu).it_value = next_tick; } -struct platform_device rtc_parisc_dev = { +static struct platform_device rtc_parisc_dev = { .name ="rtc-parisc" , .id =-1 , };
Signature · 1 line
1.5.6.5
PATCH 7/9 remove unnecessary ret variable
--- arch/parisc/kernel/time.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
arch/parisc/kernel/time.c +0 -1
@@ -223,10 +223,7 @@ static struct platform_device rtc_parisc_dev = {static int __init rtc_init (void ) { -int ret;
PATCH 8/9 remove a couple unnecessary variables
--- drivers/rtc/rtc-parisc.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-)
drivers/rtc/rtc-parisc.c +0 -3
@@ -25,11 +25,7 @@ static int parisc_get_time(struct device *dev, struct rtc_time *tm)static int parisc_set_time (struct device *dev,struct rtc_time *tm) { -int ret; - - ret =set_rtc_time (tm);
PATCH 9/9 rename p pointer to rtc
--- drivers/rtc/rtc-parisc.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/rtc/rtc-parisc.c +8 -8
@@ -38,23 +38,23 @@ static const struct rtc_class_ops parisc_rtc_ops = {static int __init parisc_rtc_probe (struct platform_device *dev) { -struct rtc_device *p; +struct rtc_device *rtc; - p =rtc_device_register ("rtc-parisc" , &dev->dev, &parisc_rtc_ops, -THIS_MODULE ); -if (IS_ERR (p)) -return PTR_ERR (p); + rtc =rtc_device_register ("rtc-parisc" , &dev->dev, &parisc_rtc_ops, +THIS_MODULE ); +if (IS_ERR (rtc)) +return PTR_ERR (rtc); -platform_set_drvdata (dev, p); +platform_set_drvdata (dev, rtc);return 0 ; } static int __exit parisc_rtc_remove(struct platform_device *dev) { -struct rtc_device *p =platform_get_drvdata (dev); +struct rtc_device *rtc =platform_get_drvdata (dev); -rtc_device_unregister (p); +rtc_device_unregister (rtc);return 0 ; }
Signature · 1 line
1.5.6.5
Quoted 4 lines · On Thu, 15 Jan 2009 16:46:47 -0700 dann frazier <[email protected]> wrote:
I recently submitted an rtc-efi driver having used rtc-parisc as a template. I received several suggestions from Alessandro Zummo and Andrew Morton that also apply to rtc-parisc. This series merges the relevant changes back into the rtc-parisc driver.
on the whole series. Thank you Dann!
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
Quoted 12 lines · Alessandro Zummo
Quoted 4 lines · On Thu, 15 Jan 2009 16:46:47 -0700 dann frazier <[email protected]> wrote:
I recently submitted an rtc-efi driver having used rtc-parisc as a template. I received several suggestions from Alessandro Zummo and Andrew Morton that also apply to rtc-parisc. This series merges the relevant changes back into the rtc-parisc driver.
Acked-by Alessandro Zummo <[email protected]>on the whole series. Thank you Dann!
How does this jive with Paul Mundt's work that kills a bunch of these rtc- drivers? (added Paul to CC)
These patches are cool with me. (I noticed you kept the same comment in the ia64 time.c code. ;-)
Quoted 2 lines · On Thu, 15 Jan 2009 19:36:06 -0500 Kyle McMartin <[email protected]> wrote:
How does this jive with Paul Mundt's work that kills a bunch of these rtc- drivers? (added Paul to CC)
You mean rtc-firmware? I'm not comfortable in having another legacy bridge. archs need to move to the rtc subsystem as a whole.
I saw a lot of improvements in this direction in the last few kernels, and I don't want to have something that will have to be removed in a couple of months.
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
Quoted 12 lines · On Fri, 16 Jan 2009 01:06:33 +0100 Alessandro Zummo…
Quoted 4 lines · On Thu, 15 Jan 2009 16:46:47 -0700 dann frazier <[email protected]> wrote:
I recently submitted an rtc-efi driver having used rtc-parisc as a template. I received several suggestions from Alessandro Zummo and Andrew Morton that also apply to rtc-parisc. This series merges the relevant changes back into the rtc-parisc driver.
Acked-by Alessandro Zummo <[email protected]>on the whole series. Thank you Dann!
I don't have a copy of these patches anywhere.
Whoever cc'ed "[email protected]", please slap thyself!
Quoted 4 lines · On Fri, 16 Jan 2009 12:47:30 -0800 Andrew Morton <[email protected]>…
I don't have a copy of these patches anywhere.
Whoever cc'ed "[email protected]", please slap thyself!
Here's the series in mbox format
http://patchwork.ozlabs.org/user/bundle/74/mbox/
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
Quoted 11 lines · On Sat, 17 Jan 2009 02:10:26 +0100 Alessandro Zummo…
Quoted 4 lines · On Fri, 16 Jan 2009 12:47:30 -0800 Andrew Morton <[email protected]>…
I don't have a copy of these patches anywhere.
Whoever cc'ed "[email protected]", please slap thyself!
Here's the series in mbox format
http://patchwork.ozlabs.org/user/bundle/74/mbox/
<fiddles around for a while, eventually gets them>
From: dann frazier <[email protected]>
Subject: [1/9] Add a missing include for linux/rtc.h
Date: Thu, 15 Jan 2009 13:46:48 -0000
That's a bit awkward - if I do a reply-to-all with review comments, it goes privately.
Obviously I can manually fix that up in this case, but...