Skip to content

Commit

Permalink
s390/ctcm: Use GFP_ATOMIC in ctcmpc_tx().
Browse files Browse the repository at this point in the history
gfp_type() uses in_interrupt() to figure out the correct GFP mask.

The usage of in_interrupt() in drivers is phased out and Linus clearly
requested that code which changes behaviour depending on context should
either be separated or the context be conveyed in an argument passed by the
caller, which usually knows the context.

ctcmpc_tx() is used as net_device_ops::ndo_start_xmit. This callback is
invoked with disabled bottom halves.

Use GFP_ATOMIC for memory allocation in ctcmpc_tx().
Remove gfp_type() since the last user is gone.

Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Sebastian Andrzej Siewior authored and Jakub Kicinski committed Dec 2, 2020
1 parent 04e4e46 commit 8f4b6e3
Showing 2 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/s390/net/ctcm_main.c
Original file line number Diff line number Diff line change
@@ -903,7 +903,7 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev)
CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len));

len = skb->len + TH_HEADER_LENGTH + PDU_HEADER_LENGTH;
newskb = __dev_alloc_skb(len, gfp_type() | GFP_DMA);
newskb = __dev_alloc_skb(len, GFP_ATOMIC | GFP_DMA);

if (!newskb) {
CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ERROR,
5 changes: 0 additions & 5 deletions drivers/s390/net/ctcm_main.h
Original file line number Diff line number Diff line change
@@ -298,11 +298,6 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv);
/* test if struct ctcm_priv of struct net_device has MPC protocol setting */
#define IS_MPCDEV(dev) IS_MPC((struct ctcm_priv *)dev->ml_priv)

static inline gfp_t gfp_type(void)
{
return in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
}

/*
* Definition of our link level header.
*/

0 comments on commit 8f4b6e3

Please sign in to comment.