mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-28 07:04:00 +08:00
net: qrtr: Add GFP flags parameter to qrtr_alloc_ctrl_packet
This will be requested for allocating control packet in atomic context. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
0baa99ee35
commit
f7dec6cb91
@ -527,18 +527,20 @@ EXPORT_SYMBOL_GPL(qrtr_endpoint_post);
|
|||||||
/**
|
/**
|
||||||
* qrtr_alloc_ctrl_packet() - allocate control packet skb
|
* qrtr_alloc_ctrl_packet() - allocate control packet skb
|
||||||
* @pkt: reference to qrtr_ctrl_pkt pointer
|
* @pkt: reference to qrtr_ctrl_pkt pointer
|
||||||
|
* @flags: the type of memory to allocate
|
||||||
*
|
*
|
||||||
* Returns newly allocated sk_buff, or NULL on failure
|
* Returns newly allocated sk_buff, or NULL on failure
|
||||||
*
|
*
|
||||||
* This function allocates a sk_buff large enough to carry a qrtr_ctrl_pkt and
|
* This function allocates a sk_buff large enough to carry a qrtr_ctrl_pkt and
|
||||||
* on success returns a reference to the control packet in @pkt.
|
* on success returns a reference to the control packet in @pkt.
|
||||||
*/
|
*/
|
||||||
static struct sk_buff *qrtr_alloc_ctrl_packet(struct qrtr_ctrl_pkt **pkt)
|
static struct sk_buff *qrtr_alloc_ctrl_packet(struct qrtr_ctrl_pkt **pkt,
|
||||||
|
gfp_t flags)
|
||||||
{
|
{
|
||||||
const int pkt_len = sizeof(struct qrtr_ctrl_pkt);
|
const int pkt_len = sizeof(struct qrtr_ctrl_pkt);
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
|
|
||||||
skb = alloc_skb(QRTR_HDR_MAX_SIZE + pkt_len, GFP_KERNEL);
|
skb = alloc_skb(QRTR_HDR_MAX_SIZE + pkt_len, flags);
|
||||||
if (!skb)
|
if (!skb)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -607,7 +609,7 @@ void qrtr_endpoint_unregister(struct qrtr_endpoint *ep)
|
|||||||
mutex_unlock(&node->ep_lock);
|
mutex_unlock(&node->ep_lock);
|
||||||
|
|
||||||
/* Notify the local controller about the event */
|
/* Notify the local controller about the event */
|
||||||
skb = qrtr_alloc_ctrl_packet(&pkt);
|
skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL);
|
||||||
if (skb) {
|
if (skb) {
|
||||||
pkt->cmd = cpu_to_le32(QRTR_TYPE_BYE);
|
pkt->cmd = cpu_to_le32(QRTR_TYPE_BYE);
|
||||||
qrtr_local_enqueue(NULL, skb, QRTR_TYPE_BYE, &src, &dst);
|
qrtr_local_enqueue(NULL, skb, QRTR_TYPE_BYE, &src, &dst);
|
||||||
@ -664,7 +666,7 @@ static void qrtr_port_remove(struct qrtr_sock *ipc)
|
|||||||
to.sq_node = QRTR_NODE_BCAST;
|
to.sq_node = QRTR_NODE_BCAST;
|
||||||
to.sq_port = QRTR_PORT_CTRL;
|
to.sq_port = QRTR_PORT_CTRL;
|
||||||
|
|
||||||
skb = qrtr_alloc_ctrl_packet(&pkt);
|
skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL);
|
||||||
if (skb) {
|
if (skb) {
|
||||||
pkt->cmd = cpu_to_le32(QRTR_TYPE_DEL_CLIENT);
|
pkt->cmd = cpu_to_le32(QRTR_TYPE_DEL_CLIENT);
|
||||||
pkt->client.node = cpu_to_le32(ipc->us.sq_node);
|
pkt->client.node = cpu_to_le32(ipc->us.sq_node);
|
||||||
@ -990,7 +992,7 @@ static int qrtr_send_resume_tx(struct qrtr_cb *cb)
|
|||||||
if (!node)
|
if (!node)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
skb = qrtr_alloc_ctrl_packet(&pkt);
|
skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL);
|
||||||
if (!skb)
|
if (!skb)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user