Lines Matching refs:p
348 static struct kobject *cdev_get(struct cdev *p) in cdev_get() argument
350 struct module *owner = p->owner; in cdev_get()
355 kobj = kobject_get_unless_zero(&p->kobj); in cdev_get()
361 void cdev_put(struct cdev *p) in cdev_put() argument
363 if (p) { in cdev_put()
364 struct module *owner = p->owner; in cdev_put()
365 kobject_put(&p->kobj); in cdev_put()
376 struct cdev *p; in chrdev_open() local
381 p = inode->i_cdev; in chrdev_open()
382 if (!p) { in chrdev_open()
393 p = inode->i_cdev; in chrdev_open()
394 if (!p) { in chrdev_open()
395 inode->i_cdev = p = new; in chrdev_open()
396 list_add(&inode->i_devices, &p->list); in chrdev_open()
398 } else if (!cdev_get(p)) in chrdev_open()
400 } else if (!cdev_get(p)) in chrdev_open()
408 fops = fops_get(p->ops); in chrdev_open()
422 cdev_put(p); in chrdev_open()
459 struct cdev *p = data; in exact_match() local
460 return &p->kobj; in exact_match()
465 struct cdev *p = data; in exact_lock() local
466 return cdev_get(p) ? 0 : -1; in exact_lock()
479 int cdev_add(struct cdev *p, dev_t dev, unsigned count) in cdev_add() argument
483 p->dev = dev; in cdev_add()
484 p->count = count; in cdev_add()
492 exact_match, exact_lock, p); in cdev_add()
496 kobject_get(p->kobj.parent); in cdev_add()
501 kfree_const(p->kobj.name); in cdev_add()
502 p->kobj.name = NULL; in cdev_add()
515 void cdev_set_parent(struct cdev *p, struct kobject *kobj) in cdev_set_parent() argument
518 p->kobj.parent = kobj; in cdev_set_parent()
601 void cdev_del(struct cdev *p) in cdev_del() argument
603 cdev_unmap(p->dev, p->count); in cdev_del()
604 kobject_put(&p->kobj); in cdev_del()
610 struct cdev *p = container_of(kobj, struct cdev, kobj); in cdev_default_release() local
613 cdev_purge(p); in cdev_default_release()
619 struct cdev *p = container_of(kobj, struct cdev, kobj); in cdev_dynamic_release() local
622 cdev_purge(p); in cdev_dynamic_release()
623 kfree(p); in cdev_dynamic_release()
642 struct cdev *p = kzalloc(sizeof(struct cdev), GFP_KERNEL); in cdev_alloc() local
643 if (p) { in cdev_alloc()
644 INIT_LIST_HEAD(&p->list); in cdev_alloc()
645 kobject_init(&p->kobj, &ktype_cdev_dynamic); in cdev_alloc()
647 return p; in cdev_alloc()