Lines Matching refs:cdev

57 	struct ssam_cdev *cdev;  member
76 static struct ssam_cdev *ssam_cdev_get(struct ssam_cdev *cdev) in ssam_cdev_get() argument
78 if (cdev) in ssam_cdev_get()
79 kref_get(&cdev->kref); in ssam_cdev_get()
81 return cdev; in ssam_cdev_get()
84 static void ssam_cdev_put(struct ssam_cdev *cdev) in ssam_cdev_put() argument
86 if (cdev) in ssam_cdev_put()
87 kref_put(&cdev->kref, __ssam_cdev_release); in ssam_cdev_put()
111 dev_warn(client->cdev->dev, in ssam_cdev_notifier()
142 lockdep_assert_held_read(&client->cdev->lock); in ssam_cdev_notifier_register()
177 status = ssam_notifier_register(client->cdev->ctrl, &nf->nf); in ssam_cdev_notifier_register()
193 lockdep_assert_held_read(&client->cdev->lock); in ssam_cdev_notifier_unregister()
208 status = ssam_notifier_unregister(client->cdev->ctrl, &client->notifier[event]->nf); in ssam_cdev_notifier_unregister()
220 down_read(&client->cdev->lock); in ssam_cdev_notifier_unregister_all()
226 if (client->cdev->ctrl) { in ssam_cdev_notifier_unregister_all()
249 up_read(&client->cdev->lock); in ssam_cdev_notifier_unregister_all()
264 lockdep_assert_held_read(&client->cdev->lock); in ssam_cdev_request()
345 status = ssam_request_sync(client->cdev->ctrl, &spec, &rsp); in ssam_cdev_request()
376 lockdep_assert_held_read(&client->cdev->lock); in ssam_cdev_notif_register()
391 lockdep_assert_held_read(&client->cdev->lock); in ssam_cdev_notif_unregister()
408 lockdep_assert_held_read(&client->cdev->lock); in ssam_cdev_event_enable()
425 return ssam_controller_event_enable(client->cdev->ctrl, reg, id, desc.flags); in ssam_cdev_event_enable()
436 lockdep_assert_held_read(&client->cdev->lock); in ssam_cdev_event_disable()
453 return ssam_controller_event_disable(client->cdev->ctrl, reg, id, desc.flags); in ssam_cdev_event_disable()
463 struct ssam_cdev *cdev = container_of(mdev, struct ssam_cdev, mdev); in ssam_cdev_device_open() local
470 client->cdev = ssam_cdev_get(cdev); in ssam_cdev_device_open()
484 down_write(&cdev->client_lock); in ssam_cdev_device_open()
486 if (test_bit(SSAM_CDEV_DEVICE_SHUTDOWN_BIT, &cdev->flags)) { in ssam_cdev_device_open()
487 up_write(&cdev->client_lock); in ssam_cdev_device_open()
491 ssam_cdev_put(client->cdev); in ssam_cdev_device_open()
495 list_add_tail(&client->node, &cdev->client_list); in ssam_cdev_device_open()
497 up_write(&cdev->client_lock); in ssam_cdev_device_open()
511 down_write(&client->cdev->client_lock); in ssam_cdev_device_release()
513 up_write(&client->cdev->client_lock); in ssam_cdev_device_release()
521 ssam_cdev_put(client->cdev); in ssam_cdev_device_release()
530 lockdep_assert_held_read(&client->cdev->lock); in __ssam_cdev_device_ioctl()
561 if (down_read_killable(&client->cdev->lock)) in ssam_cdev_device_ioctl()
564 if (test_bit(SSAM_CDEV_DEVICE_SHUTDOWN_BIT, &client->cdev->flags)) { in ssam_cdev_device_ioctl()
565 up_read(&client->cdev->lock); in ssam_cdev_device_ioctl()
571 up_read(&client->cdev->lock); in ssam_cdev_device_ioctl()
578 struct ssam_cdev *cdev = client->cdev; in ssam_cdev_read() local
582 if (down_read_killable(&cdev->lock)) in ssam_cdev_read()
586 if (test_bit(SSAM_CDEV_DEVICE_SHUTDOWN_BIT, &cdev->flags)) { in ssam_cdev_read()
587 up_read(&cdev->lock); in ssam_cdev_read()
594 up_read(&cdev->lock); in ssam_cdev_read()
602 &cdev->flags)); in ssam_cdev_read()
606 if (down_read_killable(&cdev->lock)) in ssam_cdev_read()
610 if (test_bit(SSAM_CDEV_DEVICE_SHUTDOWN_BIT, &cdev->flags)) { in ssam_cdev_read()
611 up_read(&cdev->lock); in ssam_cdev_read()
618 up_read(&cdev->lock); in ssam_cdev_read()
626 up_read(&cdev->lock); in ssam_cdev_read()
632 up_read(&cdev->lock); in ssam_cdev_read()
637 up_read(&cdev->lock); in ssam_cdev_read()
646 if (test_bit(SSAM_CDEV_DEVICE_SHUTDOWN_BIT, &client->cdev->flags)) in ssam_cdev_poll()
682 struct ssam_cdev *cdev; in ssam_dbg_device_probe() local
689 cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); in ssam_dbg_device_probe()
690 if (!cdev) in ssam_dbg_device_probe()
693 kref_init(&cdev->kref); in ssam_dbg_device_probe()
694 init_rwsem(&cdev->lock); in ssam_dbg_device_probe()
695 cdev->ctrl = ctrl; in ssam_dbg_device_probe()
696 cdev->dev = &pdev->dev; in ssam_dbg_device_probe()
698 cdev->mdev.parent = &pdev->dev; in ssam_dbg_device_probe()
699 cdev->mdev.minor = MISC_DYNAMIC_MINOR; in ssam_dbg_device_probe()
700 cdev->mdev.name = "surface_aggregator"; in ssam_dbg_device_probe()
701 cdev->mdev.nodename = "surface/aggregator"; in ssam_dbg_device_probe()
702 cdev->mdev.fops = &ssam_controller_fops; in ssam_dbg_device_probe()
704 init_rwsem(&cdev->client_lock); in ssam_dbg_device_probe()
705 INIT_LIST_HEAD(&cdev->client_list); in ssam_dbg_device_probe()
707 status = misc_register(&cdev->mdev); in ssam_dbg_device_probe()
709 kfree(cdev); in ssam_dbg_device_probe()
713 platform_set_drvdata(pdev, cdev); in ssam_dbg_device_probe()
719 struct ssam_cdev *cdev = platform_get_drvdata(pdev); in ssam_dbg_device_remove() local
726 set_bit(SSAM_CDEV_DEVICE_SHUTDOWN_BIT, &cdev->flags); in ssam_dbg_device_remove()
728 down_write(&cdev->client_lock); in ssam_dbg_device_remove()
731 list_for_each_entry(client, &cdev->client_list, node) { in ssam_dbg_device_remove()
736 list_for_each_entry(client, &cdev->client_list, node) { in ssam_dbg_device_remove()
741 list_for_each_entry(client, &cdev->client_list, node) { in ssam_dbg_device_remove()
745 up_write(&cdev->client_lock); in ssam_dbg_device_remove()
752 down_write(&cdev->lock); in ssam_dbg_device_remove()
753 cdev->ctrl = NULL; in ssam_dbg_device_remove()
754 cdev->dev = NULL; in ssam_dbg_device_remove()
755 up_write(&cdev->lock); in ssam_dbg_device_remove()
757 misc_deregister(&cdev->mdev); in ssam_dbg_device_remove()
759 ssam_cdev_put(cdev); in ssam_dbg_device_remove()