int chrdev_open(struct inode *inode, struct file *filp)
{
  ...
  if (!p) {
    ...
    kobj = kobj_lookup(cdev_map, inode->i_rdev, &idx);
    ...
  }
  ...
}