Lines Matching refs:dev
25 static void input_polldev_queue_work(struct input_polled_dev *dev) in input_polldev_queue_work() argument
29 delay = msecs_to_jiffies(dev->poll_interval); in input_polldev_queue_work()
33 queue_delayed_work(system_freezable_wq, &dev->work, delay); in input_polldev_queue_work()
38 struct input_polled_dev *dev = in input_polled_device_work() local
41 dev->poll(dev); in input_polled_device_work()
42 input_polldev_queue_work(dev); in input_polled_device_work()
47 struct input_polled_dev *dev = input_get_drvdata(input); in input_open_polled_device() local
49 if (dev->open) in input_open_polled_device()
50 dev->open(dev); in input_open_polled_device()
53 if (dev->poll_interval > 0) { in input_open_polled_device()
54 dev->poll(dev); in input_open_polled_device()
55 input_polldev_queue_work(dev); in input_open_polled_device()
63 struct input_polled_dev *dev = input_get_drvdata(input); in input_close_polled_device() local
65 cancel_delayed_work_sync(&dev->work); in input_close_polled_device()
67 if (dev->close) in input_close_polled_device()
68 dev->close(dev); in input_close_polled_device()
73 static ssize_t input_polldev_get_poll(struct device *dev, in input_polldev_get_poll() argument
76 struct input_polled_dev *polldev = dev_get_drvdata(dev); in input_polldev_get_poll()
81 static ssize_t input_polldev_set_poll(struct device *dev, in input_polldev_set_poll() argument
85 struct input_polled_dev *polldev = dev_get_drvdata(dev); in input_polldev_set_poll()
119 static ssize_t input_polldev_get_max(struct device *dev, in input_polldev_get_max() argument
122 struct input_polled_dev *polldev = dev_get_drvdata(dev); in input_polldev_get_max()
129 static ssize_t input_polldev_get_min(struct device *dev, in input_polldev_get_min() argument
132 struct input_polled_dev *polldev = dev_get_drvdata(dev); in input_polldev_get_min()
163 struct input_polled_dev *dev; in input_allocate_polled_device() local
165 dev = kzalloc(sizeof(struct input_polled_dev), GFP_KERNEL); in input_allocate_polled_device()
166 if (!dev) in input_allocate_polled_device()
169 dev->input = input_allocate_device(); in input_allocate_polled_device()
170 if (!dev->input) { in input_allocate_polled_device()
171 kfree(dev); in input_allocate_polled_device()
175 return dev; in input_allocate_polled_device()
183 static int devm_input_polldev_match(struct device *dev, void *res, void *data) in devm_input_polldev_match() argument
190 static void devm_input_polldev_release(struct device *dev, void *res) in devm_input_polldev_release() argument
195 dev_dbg(dev, "%s: dropping reference/freeing %s\n", in devm_input_polldev_release()
196 __func__, dev_name(&polldev->input->dev)); in devm_input_polldev_release()
202 static void devm_input_polldev_unregister(struct device *dev, void *res) in devm_input_polldev_unregister() argument
207 dev_dbg(dev, "%s: unregistering device %s\n", in devm_input_polldev_unregister()
208 __func__, dev_name(&polldev->input->dev)); in devm_input_polldev_unregister()
238 struct input_polled_dev *devm_input_allocate_polled_device(struct device *dev) in devm_input_allocate_polled_device() argument
254 polldev->input->dev.parent = dev; in devm_input_allocate_polled_device()
258 devres_add(dev, devres); in devm_input_allocate_polled_device()
271 void input_free_polled_device(struct input_polled_dev *dev) in input_free_polled_device() argument
273 if (dev) { in input_free_polled_device()
274 if (dev->devres_managed) in input_free_polled_device()
275 WARN_ON(devres_destroy(dev->input->dev.parent, in input_free_polled_device()
278 dev)); in input_free_polled_device()
279 input_put_device(dev->input); in input_free_polled_device()
280 kfree(dev); in input_free_polled_device()
295 int input_register_polled_device(struct input_polled_dev *dev) in input_register_polled_device() argument
298 struct input_dev *input = dev->input; in input_register_polled_device()
301 if (dev->devres_managed) { in input_register_polled_device()
307 devres->polldev = dev; in input_register_polled_device()
310 input_set_drvdata(input, dev); in input_register_polled_device()
311 INIT_DELAYED_WORK(&dev->work, input_polled_device_work); in input_register_polled_device()
313 if (!dev->poll_interval) in input_register_polled_device()
314 dev->poll_interval = 500; in input_register_polled_device()
315 if (!dev->poll_interval_max) in input_register_polled_device()
316 dev->poll_interval_max = dev->poll_interval; in input_register_polled_device()
321 input->dev.groups = input_polldev_attribute_groups; in input_register_polled_device()
338 if (dev->devres_managed) { in input_register_polled_device()
339 dev_dbg(input->dev.parent, "%s: registering %s with devres.\n", in input_register_polled_device()
340 __func__, dev_name(&input->dev)); in input_register_polled_device()
341 devres_add(input->dev.parent, devres); in input_register_polled_device()
356 void input_unregister_polled_device(struct input_polled_dev *dev) in input_unregister_polled_device() argument
358 if (dev->devres_managed) in input_unregister_polled_device()
359 WARN_ON(devres_destroy(dev->input->dev.parent, in input_unregister_polled_device()
362 dev)); in input_unregister_polled_device()
364 input_unregister_device(dev->input); in input_unregister_polled_device()