class.c (c3b399a4b6703a04ef6eb3efe35ff12163e409e0) | class.c (3ee2c40b7ac2bf121aaa1176d8ac25b6a26e3a94) |
---|---|
1/* 2 * RTC subsystem, base class 3 * 4 * Copyright (C) 2005 Tower Technologies 5 * Author: Alessandro Zummo <a.zummo@towertech.it> 6 * 7 * class skeleton from drivers/hwmon/hwmon.c 8 * --- 188 unchanged lines hidden (view full) --- 197 198 rtc->id = id; 199 rtc->ops = ops; 200 rtc->owner = owner; 201 rtc->irq_freq = 1; 202 rtc->max_user_freq = 64; 203 rtc->dev.parent = dev; 204 rtc->dev.class = rtc_class; | 1/* 2 * RTC subsystem, base class 3 * 4 * Copyright (C) 2005 Tower Technologies 5 * Author: Alessandro Zummo <a.zummo@towertech.it> 6 * 7 * class skeleton from drivers/hwmon/hwmon.c 8 * --- 188 unchanged lines hidden (view full) --- 197 198 rtc->id = id; 199 rtc->ops = ops; 200 rtc->owner = owner; 201 rtc->irq_freq = 1; 202 rtc->max_user_freq = 64; 203 rtc->dev.parent = dev; 204 rtc->dev.class = rtc_class; |
205 rtc->dev.groups = rtc_get_dev_attribute_groups(); |
|
205 rtc->dev.release = rtc_device_release; 206 207 mutex_init(&rtc->ops_lock); 208 spin_lock_init(&rtc->irq_lock); 209 spin_lock_init(&rtc->irq_task_lock); 210 init_waitqueue_head(&rtc->irq_queue); 211 212 /* Init timerqueue */ --- 22 unchanged lines hidden (view full) --- 235 err = device_register(&rtc->dev); 236 if (err) { 237 /* This will free both memory and the ID */ 238 put_device(&rtc->dev); 239 goto exit; 240 } 241 242 rtc_dev_add_device(rtc); | 206 rtc->dev.release = rtc_device_release; 207 208 mutex_init(&rtc->ops_lock); 209 spin_lock_init(&rtc->irq_lock); 210 spin_lock_init(&rtc->irq_task_lock); 211 init_waitqueue_head(&rtc->irq_queue); 212 213 /* Init timerqueue */ --- 22 unchanged lines hidden (view full) --- 236 err = device_register(&rtc->dev); 237 if (err) { 238 /* This will free both memory and the ID */ 239 put_device(&rtc->dev); 240 goto exit; 241 } 242 243 rtc_dev_add_device(rtc); |
243 rtc_sysfs_add_device(rtc); | |
244 rtc_proc_add_device(rtc); 245 246 dev_info(dev, "rtc core: registered %s as %s\n", 247 rtc->name, dev_name(&rtc->dev)); 248 249 return rtc; 250 251exit_ida: --- 14 unchanged lines hidden (view full) --- 266 */ 267void rtc_device_unregister(struct rtc_device *rtc) 268{ 269 mutex_lock(&rtc->ops_lock); 270 /* 271 * Remove innards of this RTC, then disable it, before 272 * letting any rtc_class_open() users access it again 273 */ | 244 rtc_proc_add_device(rtc); 245 246 dev_info(dev, "rtc core: registered %s as %s\n", 247 rtc->name, dev_name(&rtc->dev)); 248 249 return rtc; 250 251exit_ida: --- 14 unchanged lines hidden (view full) --- 266 */ 267void rtc_device_unregister(struct rtc_device *rtc) 268{ 269 mutex_lock(&rtc->ops_lock); 270 /* 271 * Remove innards of this RTC, then disable it, before 272 * letting any rtc_class_open() users access it again 273 */ |
274 rtc_sysfs_del_device(rtc); | |
275 rtc_dev_del_device(rtc); 276 rtc_proc_del_device(rtc); 277 device_del(&rtc->dev); 278 rtc->ops = NULL; 279 mutex_unlock(&rtc->ops_lock); 280 put_device(&rtc->dev); 281} 282EXPORT_SYMBOL_GPL(rtc_device_unregister); --- 72 unchanged lines hidden (view full) --- 355{ 356 rtc_class = class_create(THIS_MODULE, "rtc"); 357 if (IS_ERR(rtc_class)) { 358 pr_err("couldn't create class\n"); 359 return PTR_ERR(rtc_class); 360 } 361 rtc_class->pm = RTC_CLASS_DEV_PM_OPS; 362 rtc_dev_init(); | 274 rtc_dev_del_device(rtc); 275 rtc_proc_del_device(rtc); 276 device_del(&rtc->dev); 277 rtc->ops = NULL; 278 mutex_unlock(&rtc->ops_lock); 279 put_device(&rtc->dev); 280} 281EXPORT_SYMBOL_GPL(rtc_device_unregister); --- 72 unchanged lines hidden (view full) --- 354{ 355 rtc_class = class_create(THIS_MODULE, "rtc"); 356 if (IS_ERR(rtc_class)) { 357 pr_err("couldn't create class\n"); 358 return PTR_ERR(rtc_class); 359 } 360 rtc_class->pm = RTC_CLASS_DEV_PM_OPS; 361 rtc_dev_init(); |
363 rtc_sysfs_init(rtc_class); | |
364 return 0; 365} 366 367static void __exit rtc_exit(void) 368{ 369 rtc_dev_exit(); 370 class_destroy(rtc_class); 371 ida_destroy(&rtc_ida); 372} 373 374subsys_initcall(rtc_init); 375module_exit(rtc_exit); 376 377MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); 378MODULE_DESCRIPTION("RTC class support"); 379MODULE_LICENSE("GPL"); | 362 return 0; 363} 364 365static void __exit rtc_exit(void) 366{ 367 rtc_dev_exit(); 368 class_destroy(rtc_class); 369 ida_destroy(&rtc_ida); 370} 371 372subsys_initcall(rtc_init); 373module_exit(rtc_exit); 374 375MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); 376MODULE_DESCRIPTION("RTC class support"); 377MODULE_LICENSE("GPL"); |