Lines Matching refs:counter

29 	struct counter_device *const counter = dev_get_drvdata(dev);  in counter_device_release()  local
31 counter_chrdev_remove(counter); in counter_device_release()
58 int counter_register(struct counter_device *const counter) in counter_register() argument
60 struct device *const dev = &counter->dev; in counter_register()
69 mutex_init(&counter->ops_exist_lock); in counter_register()
76 if (counter->parent) { in counter_register()
77 dev->parent = counter->parent; in counter_register()
78 dev->of_node = counter->parent->of_node; in counter_register()
81 dev_set_drvdata(dev, counter); in counter_register()
83 err = counter_sysfs_add(counter); in counter_register()
87 err = counter_chrdev_add(counter); in counter_register()
91 err = cdev_device_add(&counter->chrdev, dev); in counter_register()
98 counter_chrdev_remove(counter); in counter_register()
111 void counter_unregister(struct counter_device *const counter) in counter_unregister() argument
113 if (!counter) in counter_unregister()
116 cdev_device_del(&counter->chrdev, &counter->dev); in counter_unregister()
118 mutex_lock(&counter->ops_exist_lock); in counter_unregister()
120 counter->ops = NULL; in counter_unregister()
121 wake_up(&counter->events_wait); in counter_unregister()
123 mutex_unlock(&counter->ops_exist_lock); in counter_unregister()
125 put_device(&counter->dev); in counter_unregister()
129 static void devm_counter_release(void *counter) in devm_counter_release() argument
131 counter_unregister(counter); in devm_counter_release()
147 struct counter_device *const counter) in devm_counter_register() argument
151 err = counter_register(counter); in devm_counter_register()
155 return devm_add_action_or_reset(dev, devm_counter_release, counter); in devm_counter_register()