@@ -27,7 +27,7 @@ int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm)
2727 err = - EINVAL ;
2828 else {
2929 memset (tm , 0 , sizeof (struct rtc_time ));
30- err = rtc -> ops -> read_time (rtc -> class_dev . dev , tm );
30+ err = rtc -> ops -> read_time (rtc -> dev . parent , tm );
3131 }
3232
3333 mutex_unlock (& rtc -> ops_lock );
@@ -52,7 +52,7 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
5252 else if (!rtc -> ops -> set_time )
5353 err = - EINVAL ;
5454 else
55- err = rtc -> ops -> set_time (rtc -> class_dev . dev , tm );
55+ err = rtc -> ops -> set_time (rtc -> dev . parent , tm );
5656
5757 mutex_unlock (& rtc -> ops_lock );
5858 return err ;
@@ -70,11 +70,11 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs)
7070 if (!rtc -> ops )
7171 err = - ENODEV ;
7272 else if (rtc -> ops -> set_mmss )
73- err = rtc -> ops -> set_mmss (rtc -> class_dev . dev , secs );
73+ err = rtc -> ops -> set_mmss (rtc -> dev . parent , secs );
7474 else if (rtc -> ops -> read_time && rtc -> ops -> set_time ) {
7575 struct rtc_time new , old ;
7676
77- err = rtc -> ops -> read_time (rtc -> class_dev . dev , & old );
77+ err = rtc -> ops -> read_time (rtc -> dev . parent , & old );
7878 if (err == 0 ) {
7979 rtc_time_to_tm (secs , & new );
8080
@@ -86,7 +86,7 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs)
8686 */
8787 if (!((old .tm_hour == 23 && old .tm_min == 59 ) ||
8888 (new .tm_hour == 23 && new .tm_min == 59 )))
89- err = rtc -> ops -> set_time (rtc -> class_dev . dev ,
89+ err = rtc -> ops -> set_time (rtc -> dev . parent ,
9090 & new );
9191 }
9292 }
@@ -113,7 +113,7 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
113113 err = - EINVAL ;
114114 else {
115115 memset (alarm , 0 , sizeof (struct rtc_wkalrm ));
116- err = rtc -> ops -> read_alarm (rtc -> class_dev . dev , alarm );
116+ err = rtc -> ops -> read_alarm (rtc -> dev . parent , alarm );
117117 }
118118
119119 mutex_unlock (& rtc -> ops_lock );
@@ -134,7 +134,7 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
134134 else if (!rtc -> ops -> set_alarm )
135135 err = - EINVAL ;
136136 else
137- err = rtc -> ops -> set_alarm (rtc -> class_dev . dev , alarm );
137+ err = rtc -> ops -> set_alarm (rtc -> dev . parent , alarm );
138138
139139 mutex_unlock (& rtc -> ops_lock );
140140 return err ;
@@ -167,22 +167,22 @@ EXPORT_SYMBOL_GPL(rtc_update_irq);
167167
168168struct rtc_device * rtc_class_open (char * name )
169169{
170- struct class_device * class_dev_tmp ;
170+ struct device * dev ;
171171 struct rtc_device * rtc = NULL ;
172172
173173 down (& rtc_class -> sem );
174- list_for_each_entry (class_dev_tmp , & rtc_class -> children , node ) {
175- if (strncmp (class_dev_tmp -> class_id , name , BUS_ID_SIZE ) == 0 ) {
176- class_dev_tmp = class_device_get ( class_dev_tmp );
177- if (class_dev_tmp )
178- rtc = to_rtc_device (class_dev_tmp );
174+ list_for_each_entry (dev , & rtc_class -> devices , node ) {
175+ if (strncmp (dev -> bus_id , name , BUS_ID_SIZE ) == 0 ) {
176+ dev = get_device ( dev );
177+ if (dev )
178+ rtc = to_rtc_device (dev );
179179 break ;
180180 }
181181 }
182182
183183 if (rtc ) {
184184 if (!try_module_get (rtc -> owner )) {
185- class_device_put ( class_dev_tmp );
185+ put_device ( dev );
186186 rtc = NULL ;
187187 }
188188 }
@@ -195,7 +195,7 @@ EXPORT_SYMBOL_GPL(rtc_class_open);
195195void rtc_class_close (struct rtc_device * rtc )
196196{
197197 module_put (rtc -> owner );
198- class_device_put (& rtc -> class_dev );
198+ put_device (& rtc -> dev );
199199}
200200EXPORT_SYMBOL_GPL (rtc_class_close );
201201
@@ -241,7 +241,7 @@ int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled
241241 spin_unlock_irqrestore (& rtc -> irq_task_lock , flags );
242242
243243 if (err == 0 )
244- err = rtc -> ops -> irq_set_state (rtc -> class_dev . dev , enabled );
244+ err = rtc -> ops -> irq_set_state (rtc -> dev . parent , enabled );
245245
246246 return err ;
247247}
@@ -261,7 +261,7 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
261261 spin_unlock_irqrestore (& rtc -> irq_task_lock , flags );
262262
263263 if (err == 0 ) {
264- err = rtc -> ops -> irq_set_freq (rtc -> class_dev . dev , freq );
264+ err = rtc -> ops -> irq_set_freq (rtc -> dev . parent , freq );
265265 if (err == 0 )
266266 rtc -> irq_freq = freq ;
267267 }
0 commit comments