• Home
  • Raw
  • Download

Lines Matching refs:n

39 	struct cec_notifier *n;  in cec_notifier_get_conn()  local
42 list_for_each_entry(n, &cec_notifiers, head) { in cec_notifier_get_conn()
43 if (n->hdmi_dev == hdmi_dev && in cec_notifier_get_conn()
45 (n->conn_name && !strcmp(n->conn_name, conn_name)))) { in cec_notifier_get_conn()
46 kref_get(&n->kref); in cec_notifier_get_conn()
48 return n; in cec_notifier_get_conn()
51 n = kzalloc(sizeof(*n), GFP_KERNEL); in cec_notifier_get_conn()
52 if (!n) in cec_notifier_get_conn()
54 n->hdmi_dev = hdmi_dev; in cec_notifier_get_conn()
56 n->conn_name = kstrdup(conn_name, GFP_KERNEL); in cec_notifier_get_conn()
57 if (!n->conn_name) { in cec_notifier_get_conn()
58 kfree(n); in cec_notifier_get_conn()
59 n = NULL; in cec_notifier_get_conn()
63 n->phys_addr = CEC_PHYS_ADDR_INVALID; in cec_notifier_get_conn()
65 mutex_init(&n->lock); in cec_notifier_get_conn()
66 kref_init(&n->kref); in cec_notifier_get_conn()
67 list_add_tail(&n->head, &cec_notifiers); in cec_notifier_get_conn()
70 return n; in cec_notifier_get_conn()
76 struct cec_notifier *n = in cec_notifier_release() local
79 list_del(&n->head); in cec_notifier_release()
80 kfree(n->conn_name); in cec_notifier_release()
81 kfree(n); in cec_notifier_release()
84 void cec_notifier_put(struct cec_notifier *n) in cec_notifier_put() argument
87 kref_put(&n->kref, cec_notifier_release); in cec_notifier_put()
96 struct cec_notifier *n = cec_notifier_get_conn(hdmi_dev, conn_name); in cec_notifier_conn_register() local
98 if (!n) in cec_notifier_conn_register()
99 return n; in cec_notifier_conn_register()
101 mutex_lock(&n->lock); in cec_notifier_conn_register()
102 n->phys_addr = CEC_PHYS_ADDR_INVALID; in cec_notifier_conn_register()
104 n->conn_info = *conn_info; in cec_notifier_conn_register()
106 memset(&n->conn_info, 0, sizeof(n->conn_info)); in cec_notifier_conn_register()
107 if (n->cec_adap) { in cec_notifier_conn_register()
108 cec_phys_addr_invalidate(n->cec_adap); in cec_notifier_conn_register()
109 cec_s_conn_info(n->cec_adap, conn_info); in cec_notifier_conn_register()
111 mutex_unlock(&n->lock); in cec_notifier_conn_register()
112 return n; in cec_notifier_conn_register()
116 void cec_notifier_conn_unregister(struct cec_notifier *n) in cec_notifier_conn_unregister() argument
118 if (!n) in cec_notifier_conn_unregister()
121 mutex_lock(&n->lock); in cec_notifier_conn_unregister()
122 memset(&n->conn_info, 0, sizeof(n->conn_info)); in cec_notifier_conn_unregister()
123 n->phys_addr = CEC_PHYS_ADDR_INVALID; in cec_notifier_conn_unregister()
124 if (n->cec_adap) { in cec_notifier_conn_unregister()
125 cec_phys_addr_invalidate(n->cec_adap); in cec_notifier_conn_unregister()
126 cec_s_conn_info(n->cec_adap, NULL); in cec_notifier_conn_unregister()
128 mutex_unlock(&n->lock); in cec_notifier_conn_unregister()
129 cec_notifier_put(n); in cec_notifier_conn_unregister()
137 struct cec_notifier *n; in cec_notifier_cec_adap_register() local
142 n = cec_notifier_get_conn(hdmi_dev, conn_name); in cec_notifier_cec_adap_register()
143 if (!n) in cec_notifier_cec_adap_register()
144 return n; in cec_notifier_cec_adap_register()
146 mutex_lock(&n->lock); in cec_notifier_cec_adap_register()
147 n->cec_adap = adap; in cec_notifier_cec_adap_register()
148 adap->conn_info = n->conn_info; in cec_notifier_cec_adap_register()
149 adap->notifier = n; in cec_notifier_cec_adap_register()
150 cec_s_phys_addr(adap, n->phys_addr, false); in cec_notifier_cec_adap_register()
151 mutex_unlock(&n->lock); in cec_notifier_cec_adap_register()
152 return n; in cec_notifier_cec_adap_register()
156 void cec_notifier_cec_adap_unregister(struct cec_notifier *n) in cec_notifier_cec_adap_unregister() argument
158 if (!n) in cec_notifier_cec_adap_unregister()
161 mutex_lock(&n->lock); in cec_notifier_cec_adap_unregister()
162 n->cec_adap->notifier = NULL; in cec_notifier_cec_adap_unregister()
163 n->cec_adap = NULL; in cec_notifier_cec_adap_unregister()
164 n->callback = NULL; in cec_notifier_cec_adap_unregister()
165 mutex_unlock(&n->lock); in cec_notifier_cec_adap_unregister()
166 cec_notifier_put(n); in cec_notifier_cec_adap_unregister()
170 void cec_notifier_set_phys_addr(struct cec_notifier *n, u16 pa) in cec_notifier_set_phys_addr() argument
172 if (n == NULL) in cec_notifier_set_phys_addr()
175 mutex_lock(&n->lock); in cec_notifier_set_phys_addr()
176 n->phys_addr = pa; in cec_notifier_set_phys_addr()
177 if (n->callback) in cec_notifier_set_phys_addr()
178 n->callback(n->cec_adap, n->phys_addr); in cec_notifier_set_phys_addr()
179 else if (n->cec_adap) in cec_notifier_set_phys_addr()
180 cec_s_phys_addr(n->cec_adap, n->phys_addr, false); in cec_notifier_set_phys_addr()
181 mutex_unlock(&n->lock); in cec_notifier_set_phys_addr()
185 void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, in cec_notifier_set_phys_addr_from_edid() argument
190 if (n == NULL) in cec_notifier_set_phys_addr_from_edid()
196 cec_notifier_set_phys_addr(n, pa); in cec_notifier_set_phys_addr_from_edid()
200 void cec_notifier_register(struct cec_notifier *n, in cec_notifier_register() argument
204 kref_get(&n->kref); in cec_notifier_register()
205 mutex_lock(&n->lock); in cec_notifier_register()
206 n->cec_adap = adap; in cec_notifier_register()
207 n->callback = callback; in cec_notifier_register()
208 n->callback(adap, n->phys_addr); in cec_notifier_register()
209 mutex_unlock(&n->lock); in cec_notifier_register()
213 void cec_notifier_unregister(struct cec_notifier *n) in cec_notifier_unregister() argument
216 if (!n->callback) in cec_notifier_unregister()
219 mutex_lock(&n->lock); in cec_notifier_unregister()
220 n->callback = NULL; in cec_notifier_unregister()
221 n->cec_adap->notifier = NULL; in cec_notifier_unregister()
222 n->cec_adap = NULL; in cec_notifier_unregister()
223 mutex_unlock(&n->lock); in cec_notifier_unregister()
224 cec_notifier_put(n); in cec_notifier_unregister()