Skip to content

Commit 52a8d96

Browse files
author
Inaky Perez-Gonzalez
committed
wimax: document why wimax_msg_*() operations can be used in any state
Funcion documentation for wimax_msg_alloc() and wimax_msg_send() needs to clarify that they can be used in the very early stages of a wimax_dev lifecycle. Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
1 parent 052991d commit 52a8d96

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎net/wimax/op-msg.c‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,20 @@
108108
* Don't use skb_push()/skb_pull()/skb_reserve() on the skb, as
109109
* wimax_msg_send() depends on skb->data being placed at the
110110
* beginning of the user message.
111+
*
112+
* Unlike other WiMAX stack calls, this call can be used way early,
113+
* even before wimax_dev_add() is called, as long as the
114+
* wimax_dev->net_dev pointer is set to point to a proper
115+
* net_dev. This is so that drivers can use it early in case they need
116+
* to send stuff around or communicate with user space.
111117
*/
112118
struct sk_buff *wimax_msg_alloc(struct wimax_dev *wimax_dev,
113119
const char *pipe_name,
114120
const void *msg, size_t size,
115121
gfp_t gfp_flags)
116122
{
117123
int result;
118-
struct device *dev = wimax_dev->net_dev->dev.parent;
124+
struct device *dev = wimax_dev_to_dev(wimax_dev);
119125
size_t msg_size;
120126
void *genl_msg;
121127
struct sk_buff *skb;
@@ -161,7 +167,6 @@ struct sk_buff *wimax_msg_alloc(struct wimax_dev *wimax_dev,
161167
error_new:
162168
nlmsg_free(skb);
163169
return ERR_PTR(result);
164-
165170
}
166171
EXPORT_SYMBOL_GPL(wimax_msg_alloc);
167172

@@ -256,10 +261,16 @@ EXPORT_SYMBOL_GPL(wimax_msg_len);
256261
* Don't use skb_push()/skb_pull()/skb_reserve() on the skb, as
257262
* wimax_msg_send() depends on skb->data being placed at the
258263
* beginning of the user message.
264+
*
265+
* Unlike other WiMAX stack calls, this call can be used way early,
266+
* even before wimax_dev_add() is called, as long as the
267+
* wimax_dev->net_dev pointer is set to point to a proper
268+
* net_dev. This is so that drivers can use it early in case they need
269+
* to send stuff around or communicate with user space.
259270
*/
260271
int wimax_msg_send(struct wimax_dev *wimax_dev, struct sk_buff *skb)
261272
{
262-
struct device *dev = wimax_dev->net_dev->dev.parent;
273+
struct device *dev = wimax_dev_to_dev(wimax_dev);
263274
void *msg = skb->data;
264275
size_t size = skb->len;
265276
might_sleep();

0 commit comments

Comments
 (0)