Lines Matching refs:n
36 struct cec_notifier *n; in cec_notifier_get_conn() local
39 list_for_each_entry(n, &cec_notifiers, head) { in cec_notifier_get_conn()
40 if (n->dev == dev && in cec_notifier_get_conn()
41 (!conn || !strcmp(n->conn, conn))) { in cec_notifier_get_conn()
42 kref_get(&n->kref); in cec_notifier_get_conn()
44 return n; in cec_notifier_get_conn()
47 n = kzalloc(sizeof(*n), GFP_KERNEL); in cec_notifier_get_conn()
48 if (!n) in cec_notifier_get_conn()
50 n->dev = dev; in cec_notifier_get_conn()
52 n->conn = kstrdup(conn, GFP_KERNEL); in cec_notifier_get_conn()
53 n->phys_addr = CEC_PHYS_ADDR_INVALID; in cec_notifier_get_conn()
54 mutex_init(&n->lock); in cec_notifier_get_conn()
55 kref_init(&n->kref); in cec_notifier_get_conn()
56 list_add_tail(&n->head, &cec_notifiers); in cec_notifier_get_conn()
59 return n; in cec_notifier_get_conn()
65 struct cec_notifier *n = in cec_notifier_release() local
68 list_del(&n->head); in cec_notifier_release()
69 kfree(n->conn); in cec_notifier_release()
70 kfree(n); in cec_notifier_release()
73 void cec_notifier_put(struct cec_notifier *n) in cec_notifier_put() argument
76 kref_put(&n->kref, cec_notifier_release); in cec_notifier_put()
81 void cec_notifier_set_phys_addr(struct cec_notifier *n, u16 pa) in cec_notifier_set_phys_addr() argument
83 if (n == NULL) in cec_notifier_set_phys_addr()
86 mutex_lock(&n->lock); in cec_notifier_set_phys_addr()
87 n->phys_addr = pa; in cec_notifier_set_phys_addr()
88 if (n->callback) in cec_notifier_set_phys_addr()
89 n->callback(n->cec_adap, n->phys_addr); in cec_notifier_set_phys_addr()
90 mutex_unlock(&n->lock); in cec_notifier_set_phys_addr()
94 void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, in cec_notifier_set_phys_addr_from_edid() argument
99 if (n == NULL) in cec_notifier_set_phys_addr_from_edid()
105 cec_notifier_set_phys_addr(n, pa); in cec_notifier_set_phys_addr_from_edid()
109 void cec_notifier_register(struct cec_notifier *n, in cec_notifier_register() argument
113 kref_get(&n->kref); in cec_notifier_register()
114 mutex_lock(&n->lock); in cec_notifier_register()
115 n->cec_adap = adap; in cec_notifier_register()
116 n->callback = callback; in cec_notifier_register()
117 n->callback(adap, n->phys_addr); in cec_notifier_register()
118 mutex_unlock(&n->lock); in cec_notifier_register()
122 void cec_notifier_unregister(struct cec_notifier *n) in cec_notifier_unregister() argument
124 mutex_lock(&n->lock); in cec_notifier_unregister()
125 n->callback = NULL; in cec_notifier_unregister()
126 mutex_unlock(&n->lock); in cec_notifier_unregister()
127 cec_notifier_put(n); in cec_notifier_unregister()