aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/class.c')
-rw-r--r--drivers/rtc/class.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 9230001bd591..d58d74cf570e 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -23,9 +23,9 @@ static DEFINE_IDR(rtc_idr);
23static DEFINE_MUTEX(idr_lock); 23static DEFINE_MUTEX(idr_lock);
24struct class *rtc_class; 24struct class *rtc_class;
25 25
26static void rtc_device_release(struct class_device *class_dev) 26static void rtc_device_release(struct device *dev)
27{ 27{
28 struct rtc_device *rtc = to_rtc_device(class_dev); 28 struct rtc_device *rtc = to_rtc_device(dev);
29 mutex_lock(&idr_lock); 29 mutex_lock(&idr_lock);
30 idr_remove(&rtc_idr, rtc->id); 30 idr_remove(&rtc_idr, rtc->id);
31 mutex_unlock(&idr_lock); 31 mutex_unlock(&idr_lock);
@@ -73,18 +73,18 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
73 rtc->ops = ops; 73 rtc->ops = ops;
74 rtc->owner = owner; 74 rtc->owner = owner;
75 rtc->max_user_freq = 64; 75 rtc->max_user_freq = 64;
76 rtc->class_dev.dev = dev; 76 rtc->dev.parent = dev;
77 rtc->class_dev.class = rtc_class; 77 rtc->dev.class = rtc_class;
78 rtc->class_dev.release = rtc_device_release; 78 rtc->dev.release = rtc_device_release;
79 79
80 mutex_init(&rtc->ops_lock); 80 mutex_init(&rtc->ops_lock);
81 spin_lock_init(&rtc->irq_lock); 81 spin_lock_init(&rtc->irq_lock);
82 spin_lock_init(&rtc->irq_task_lock); 82 spin_lock_init(&rtc->irq_task_lock);
83 83
84 strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); 84 strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE);
85 snprintf(rtc->class_dev.class_id, BUS_ID_SIZE, "rtc%d", id); 85 snprintf(rtc->dev.bus_id, BUS_ID_SIZE, "rtc%d", id);
86 86
87 err = class_device_register(&rtc->class_dev); 87 err = device_register(&rtc->dev);
88 if (err) 88 if (err)
89 goto exit_kfree; 89 goto exit_kfree;
90 90
@@ -93,7 +93,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
93 rtc_proc_add_device(rtc); 93 rtc_proc_add_device(rtc);
94 94
95 dev_info(dev, "rtc core: registered %s as %s\n", 95 dev_info(dev, "rtc core: registered %s as %s\n",
96 rtc->name, rtc->class_dev.class_id); 96 rtc->name, rtc->dev.bus_id);
97 97
98 return rtc; 98 return rtc;
99 99
@@ -120,7 +120,7 @@ EXPORT_SYMBOL_GPL(rtc_device_register);
120 */ 120 */
121void rtc_device_unregister(struct rtc_device *rtc) 121void rtc_device_unregister(struct rtc_device *rtc)
122{ 122{
123 if (class_device_get(&rtc->class_dev) != NULL) { 123 if (get_device(&rtc->dev) != NULL) {
124 mutex_lock(&rtc->ops_lock); 124 mutex_lock(&rtc->ops_lock);
125 /* remove innards of this RTC, then disable it, before 125 /* remove innards of this RTC, then disable it, before
126 * letting any rtc_class_open() users access it again 126 * letting any rtc_class_open() users access it again
@@ -128,10 +128,10 @@ void rtc_device_unregister(struct rtc_device *rtc)
128 rtc_sysfs_del_device(rtc); 128 rtc_sysfs_del_device(rtc);
129 rtc_dev_del_device(rtc); 129 rtc_dev_del_device(rtc);
130 rtc_proc_del_device(rtc); 130 rtc_proc_del_device(rtc);
131 class_device_unregister(&rtc->class_dev); 131 device_unregister(&rtc->dev);
132 rtc->ops = NULL; 132 rtc->ops = NULL;
133 mutex_unlock(&rtc->ops_lock); 133 mutex_unlock(&rtc->ops_lock);
134 class_device_put(&rtc->class_dev); 134 put_device(&rtc->dev);
135 } 135 }
136} 136}
137EXPORT_SYMBOL_GPL(rtc_device_unregister); 137EXPORT_SYMBOL_GPL(rtc_device_unregister);