Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ede23fa8 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller
Browse files

drivers:net: Convert dma_alloc_coherent(...__GFP_ZERO) to dma_zalloc_coherent



__GFP_ZERO is an uncommon flag and perhaps is better
not used.  static inline dma_zalloc_coherent exists
so convert the uses of dma_alloc_coherent with __GFP_ZERO
to the more common kernel style with zalloc.

Remove memset from the static inline dma_zalloc_coherent
and add just one use of __GFP_ZERO instead.

Trivially reduces the size of the existing uses of
dma_zalloc_coherent.

Realign arguments as appropriate.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Acked-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Acked-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent afe4fd06
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -1464,18 +1464,18 @@ static int greth_of_probe(struct platform_device *ofdev)
	}
	}


	/* Allocate TX descriptor ring in coherent memory */
	/* Allocate TX descriptor ring in coherent memory */
	greth->tx_bd_base = dma_alloc_coherent(greth->dev, 1024,
	greth->tx_bd_base = dma_zalloc_coherent(greth->dev, 1024,
						&greth->tx_bd_base_phys,
						&greth->tx_bd_base_phys,
					       GFP_KERNEL | __GFP_ZERO);
						GFP_KERNEL);
	if (!greth->tx_bd_base) {
	if (!greth->tx_bd_base) {
		err = -ENOMEM;
		err = -ENOMEM;
		goto error3;
		goto error3;
	}
	}


	/* Allocate RX descriptor ring in coherent memory */
	/* Allocate RX descriptor ring in coherent memory */
	greth->rx_bd_base = dma_alloc_coherent(greth->dev, 1024,
	greth->rx_bd_base = dma_zalloc_coherent(greth->dev, 1024,
						&greth->rx_bd_base_phys,
						&greth->rx_bd_base_phys,
					       GFP_KERNEL | __GFP_ZERO);
						GFP_KERNEL);
	if (!greth->rx_bd_base) {
	if (!greth->rx_bd_base) {
		err = -ENOMEM;
		err = -ENOMEM;
		goto error4;
		goto error4;
+2 −4
Original line number Original line Diff line number Diff line
@@ -948,8 +948,7 @@ static int bcm_enet_open(struct net_device *dev)


	/* allocate rx dma ring */
	/* allocate rx dma ring */
	size = priv->rx_ring_size * sizeof(struct bcm_enet_desc);
	size = priv->rx_ring_size * sizeof(struct bcm_enet_desc);
	p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma,
	p = dma_zalloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL);
			       GFP_KERNEL | __GFP_ZERO);
	if (!p) {
	if (!p) {
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto out_freeirq_tx;
		goto out_freeirq_tx;
@@ -960,8 +959,7 @@ static int bcm_enet_open(struct net_device *dev)


	/* allocate tx dma ring */
	/* allocate tx dma ring */
	size = priv->tx_ring_size * sizeof(struct bcm_enet_desc);
	size = priv->tx_ring_size * sizeof(struct bcm_enet_desc);
	p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma,
	p = dma_zalloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL);
			       GFP_KERNEL | __GFP_ZERO);
	if (!p) {
	if (!p) {
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto out_free_rx_ring;
		goto out_free_rx_ring;
+2 −3
Original line number Original line Diff line number Diff line
@@ -853,9 +853,8 @@ bnx2_alloc_mem(struct bnx2 *bp)
	bp->status_stats_size = status_blk_size +
	bp->status_stats_size = status_blk_size +
				sizeof(struct statistics_block);
				sizeof(struct statistics_block);


	status_blk = dma_alloc_coherent(&bp->pdev->dev, bp->status_stats_size,
	status_blk = dma_zalloc_coherent(&bp->pdev->dev, bp->status_stats_size,
					&bp->status_blk_mapping,
					 &bp->status_blk_mapping, GFP_KERNEL);
					GFP_KERNEL | __GFP_ZERO);
	if (status_blk == NULL)
	if (status_blk == NULL)
		goto alloc_mem_err;
		goto alloc_mem_err;


+2 −3
Original line number Original line Diff line number Diff line
@@ -2070,8 +2070,7 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,
			    bool is_pf);
			    bool is_pf);


#define BNX2X_ILT_ZALLOC(x, y, size)					\
#define BNX2X_ILT_ZALLOC(x, y, size)					\
	x = dma_alloc_coherent(&bp->pdev->dev, size, y,		\
	x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL)
			       GFP_KERNEL | __GFP_ZERO)


#define BNX2X_ILT_FREE(x, y, size) \
#define BNX2X_ILT_FREE(x, y, size) \
	do { \
	do { \
+1 −2
Original line number Original line Diff line number Diff line
@@ -51,8 +51,7 @@ extern int int_mode;


#define BNX2X_PCI_ALLOC(x, y, size) \
#define BNX2X_PCI_ALLOC(x, y, size) \
	do { \
	do { \
		x = dma_alloc_coherent(&bp->pdev->dev, size, y, \
		x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
				       GFP_KERNEL | __GFP_ZERO); \
		if (x == NULL) \
		if (x == NULL) \
			goto alloc_mem_err; \
			goto alloc_mem_err; \
		DP(NETIF_MSG_HW, "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n", \
		DP(NETIF_MSG_HW, "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n", \
Loading