diff options
-rw-r--r-- | drivers/connector/cn_queue.c | 3 | ||||
-rw-r--r-- | drivers/connector/connector.c | 11 | ||||
-rw-r--r-- | include/linux/connector.h | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c index 4a1dfe1f4ba9..b4cfac93f723 100644 --- a/drivers/connector/cn_queue.c +++ b/drivers/connector/cn_queue.c | |||
@@ -78,8 +78,9 @@ void cn_queue_wrapper(struct work_struct *work) | |||
78 | struct cn_callback_entry *cbq = | 78 | struct cn_callback_entry *cbq = |
79 | container_of(work, struct cn_callback_entry, work); | 79 | container_of(work, struct cn_callback_entry, work); |
80 | struct cn_callback_data *d = &cbq->data; | 80 | struct cn_callback_data *d = &cbq->data; |
81 | struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb)); | ||
81 | 82 | ||
82 | d->callback(d->callback_priv); | 83 | d->callback(msg); |
83 | 84 | ||
84 | d->destruct_data(d->ddata); | 85 | d->destruct_data(d->ddata); |
85 | d->ddata = NULL; | 86 | d->ddata = NULL; |
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 74f52af79563..fc9887fa453f 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -129,10 +129,11 @@ 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 | */ |
132 | static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data) | 132 | static int cn_call_callback(struct sk_buff *skb, void (*destruct_data)(void *), void *data) |
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); |
@@ -140,7 +141,7 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v | |||
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.ddata == NULL)) { |
143 | __cbq->data.callback_priv = msg; | 144 | __cbq->data.skb = skb; |
144 | 145 | ||
145 | __cbq->data.ddata = data; | 146 | __cbq->data.ddata = data; |
146 | __cbq->data.destruct_data = destruct_data; | 147 | __cbq->data.destruct_data = destruct_data; |
@@ -156,7 +157,7 @@ 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); | 157 | __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC); |
157 | if (__new_cbq) { | 158 | if (__new_cbq) { |
158 | d = &__new_cbq->data; | 159 | d = &__new_cbq->data; |
159 | d->callback_priv = msg; | 160 | d->skb = skb; |
160 | d->callback = __cbq->data.callback; | 161 | d->callback = __cbq->data.callback; |
161 | d->ddata = data; | 162 | d->ddata = data; |
162 | d->destruct_data = destruct_data; | 163 | d->destruct_data = destruct_data; |
@@ -191,7 +192,6 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v | |||
191 | */ | 192 | */ |
192 | static void cn_rx_skb(struct sk_buff *__skb) | 193 | static void cn_rx_skb(struct sk_buff *__skb) |
193 | { | 194 | { |
194 | struct cn_msg *msg; | ||
195 | struct nlmsghdr *nlh; | 195 | struct nlmsghdr *nlh; |
196 | int err; | 196 | int err; |
197 | struct sk_buff *skb; | 197 | struct sk_buff *skb; |
@@ -208,8 +208,7 @@ static void cn_rx_skb(struct sk_buff *__skb) | |||
208 | return; | 208 | return; |
209 | } | 209 | } |
210 | 210 | ||
211 | msg = NLMSG_DATA(nlh); | 211 | err = cn_call_callback(skb, (void (*)(void *))kfree_skb, skb); |
212 | err = cn_call_callback(msg, (void (*)(void *))kfree_skb, skb); | ||
213 | if (err < 0) | 212 | if (err < 0) |
214 | kfree_skb(skb); | 213 | kfree_skb(skb); |
215 | } | 214 | } |
diff --git a/include/linux/connector.h b/include/linux/connector.h index 47ebf416f512..05a7a14126d8 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
@@ -134,8 +134,8 @@ struct cn_callback_id { | |||
134 | struct cn_callback_data { | 134 | struct cn_callback_data { |
135 | void (*destruct_data) (void *); | 135 | void (*destruct_data) (void *); |
136 | void *ddata; | 136 | void *ddata; |
137 | 137 | ||
138 | void *callback_priv; | 138 | struct sk_buff *skb; |
139 | void (*callback) (struct cn_msg *); | 139 | void (*callback) (struct cn_msg *); |
140 | 140 | ||
141 | void *free; | 141 | void *free; |