aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/connector/connector.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/connector/connector.c')
-rw-r--r--drivers/connector/connector.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 74f52af79563..f06024668f99 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -129,21 +129,19 @@ EXPORT_SYMBOL_GPL(cn_netlink_send);
129/* 129/*
130 * Callback helper - queues work and setup destructor for given data. 130 * Callback helper - queues work and setup destructor for given data.
131 */ 131 */
132static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data) 132static int cn_call_callback(struct sk_buff *skb)
133{ 133{
134 struct cn_callback_entry *__cbq, *__new_cbq; 134 struct cn_callback_entry *__cbq, *__new_cbq;
135 struct cn_dev *dev = &cdev; 135 struct cn_dev *dev = &cdev;
136 struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb));
136 int err = -ENODEV; 137 int err = -ENODEV;
137 138
138 spin_lock_bh(&dev->cbdev->queue_lock); 139 spin_lock_bh(&dev->cbdev->queue_lock);
139 list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { 140 list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) {
140 if (cn_cb_equal(&__cbq->id.id, &msg->id)) { 141 if (cn_cb_equal(&__cbq->id.id, &msg->id)) {
141 if (likely(!work_pending(&__cbq->work) && 142 if (likely(!work_pending(&__cbq->work) &&
142 __cbq->data.ddata == NULL)) { 143 __cbq->data.skb == NULL)) {
143 __cbq->data.callback_priv = msg; 144 __cbq->data.skb = skb;
144
145 __cbq->data.ddata = data;
146 __cbq->data.destruct_data = destruct_data;
147 145
148 if (queue_cn_work(__cbq, &__cbq->work)) 146 if (queue_cn_work(__cbq, &__cbq->work))
149 err = 0; 147 err = 0;
@@ -156,10 +154,8 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
156 __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC); 154 __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
157 if (__new_cbq) { 155 if (__new_cbq) {
158 d = &__new_cbq->data; 156 d = &__new_cbq->data;
159 d->callback_priv = msg; 157 d->skb = skb;
160 d->callback = __cbq->data.callback; 158 d->callback = __cbq->data.callback;
161 d->ddata = data;
162 d->destruct_data = destruct_data;
163 d->free = __new_cbq; 159 d->free = __new_cbq;
164 160
165 __new_cbq->pdev = __cbq->pdev; 161 __new_cbq->pdev = __cbq->pdev;
@@ -191,7 +187,6 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
191 */ 187 */
192static void cn_rx_skb(struct sk_buff *__skb) 188static void cn_rx_skb(struct sk_buff *__skb)
193{ 189{
194 struct cn_msg *msg;
195 struct nlmsghdr *nlh; 190 struct nlmsghdr *nlh;
196 int err; 191 int err;
197 struct sk_buff *skb; 192 struct sk_buff *skb;
@@ -208,8 +203,7 @@ static void cn_rx_skb(struct sk_buff *__skb)
208 return; 203 return;
209 } 204 }
210 205
211 msg = NLMSG_DATA(nlh); 206 err = cn_call_callback(skb);
212 err = cn_call_callback(msg, (void (*)(void *))kfree_skb, skb);
213 if (err < 0) 207 if (err < 0)
214 kfree_skb(skb); 208 kfree_skb(skb);
215 } 209 }
@@ -270,7 +264,7 @@ static void cn_notify(struct cb_id *id, u32 notify_event)
270 * May sleep. 264 * May sleep.
271 */ 265 */
272int cn_add_callback(struct cb_id *id, char *name, 266int cn_add_callback(struct cb_id *id, char *name,
273 void (*callback)(struct cn_msg *)) 267 void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
274{ 268{
275 int err; 269 int err;
276 struct cn_dev *dev = &cdev; 270 struct cn_dev *dev = &cdev;
@@ -352,7 +346,7 @@ static int cn_ctl_msg_equals(struct cn_ctl_msg *m1, struct cn_ctl_msg *m2)
352 * 346 *
353 * Used for notification of a request's processing. 347 * Used for notification of a request's processing.
354 */ 348 */
355static void cn_callback(struct cn_msg *msg) 349static void cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
356{ 350{
357 struct cn_ctl_msg *ctl; 351 struct cn_ctl_msg *ctl;
358 struct cn_ctl_entry *ent; 352 struct cn_ctl_entry *ent;