/* The function registers previously initialized polled input device with input layer. The device should be allocated with call to input_allocate_polled_device(). Callers should also set up poll() method and set up capabilities (id, name, phys, bits) of the corresponing input_dev structure.  */
int input_register_polled_device(struct input_polled_dev *dev)
/* The function registers previously initialized polled input device with input layer. The device should be allocated with call to input_allocate_polled_device(). Callers should also set up poll() method and set up capabilities (id, name, phys, bits) of the corresponing input_dev structure.  */
int input_register_polled_device(struct input_polled_dev *dev)
{
	struct input_dev *input = dev->input;
	int error;
	input_set_drvdata(input, dev);
	INIT_DELAYED_WORK(&dev->work, input_polled_device_work);
	if (!dev->poll_interval)
		dev->poll_interval = 500;
	if (!dev->poll_interval_max)
		dev->poll_interval_max = dev->poll_interval;
	input->open = input_open_polled_device;
	input->close = input_close_polled_device;
	error = input_register_device(input);
	if (error)
		return error;
	error = sysfs_create_group(&input->dev.kobj,
				   &input_polldev_attribute_group);
	if (error) {
		input_unregister_device(input);
		return error;
	}
	input_get_device(input);
	return 0;
}