/**
 * input_register_device - register device with input core
 * @dev: device to be registered
 *
 * This function registers device with input core. The device must be
 * allocated with input_allocate_device() and all it's capabilities
 * set up before registering.
 * If function fails the device must be freed with input_free_device().
 * Once device has been successfully registered it can be unregistered
 * with input_unregister_device(); input_free_device() should not be
 * called in this case.
 */
int input_register_device(struct input_dev *dev)
{
    //定义一些函数中将用到的局部变量
  static atomic_t input_no = ATOMIC_INIT(0);
  struct input_handler *handler;
  const char *path;
  int error;
  //设置 input_dev 所支持的事件类型,由 evbit 成员来表示。具体类型在后面归纳。
  /* Every input device generates EV_SYN/SYN_REPORT events. */
  __set_bit(EV_SYN, dev->evbit);
 
  /* KEY_RESERVED is not supposed to be transmitted to userspace. */
  __clear_bit(KEY_RESERVED, dev->keybit);
 
  /* Make sure that bitmasks not mentioned in dev->evbit are clean. */
  input_cleanse_bitmasks(dev);