All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 06/20] mlx5: Replace PCI pool old API
       [not found] ` <20170226192425.13098-7-romain.perier@collabora.com>
@ 2017-02-27 11:08   ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:08 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:11PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 11 ++++++-----
>  include/linux/mlx5/driver.h                   |  2 +-
>  2 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
> index caa837e..6eef344 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
> @@ -1061,7 +1061,7 @@ static struct mlx5_cmd_mailbox *alloc_cmd_box(struct mlx5_core_dev *dev,
>  	if (!mailbox)
>  		return ERR_PTR(-ENOMEM);
>  
> -	mailbox->buf = pci_pool_zalloc(dev->cmd.pool, flags,
> +	mailbox->buf = dma_pool_zalloc(dev->cmd.pool, flags,
>  				       &mailbox->dma);
>  	if (!mailbox->buf) {
>  		mlx5_core_dbg(dev, "failed allocation\n");
> @@ -1076,7 +1076,7 @@ static struct mlx5_cmd_mailbox *alloc_cmd_box(struct mlx5_core_dev *dev,
>  static void free_cmd_box(struct mlx5_core_dev *dev,
>  			 struct mlx5_cmd_mailbox *mailbox)
>  {
> -	pci_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma);
> +	dma_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma);
>  	kfree(mailbox);
>  }
>  
> @@ -1696,7 +1696,8 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev)
>  		return -EINVAL;
>  	}
>  
> -	cmd->pool = pci_pool_create("mlx5_cmd", dev->pdev, size, align, 0);
> +	cmd->pool = dma_pool_create("mlx5_cmd", &dev->pdev->dev, size, align,
> +				    0);
>  	if (!cmd->pool)
>  		return -ENOMEM;
>  
> @@ -1786,7 +1787,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev)
>  	free_cmd_page(dev, cmd);
>  
>  err_free_pool:
> -	pci_pool_destroy(cmd->pool);
> +	dma_pool_destroy(cmd->pool);
>  
>  	return err;
>  }
> @@ -1800,6 +1801,6 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev)
>  	destroy_workqueue(cmd->wq);
>  	destroy_msg_cache(dev);
>  	free_cmd_page(dev, cmd);
> -	pci_pool_destroy(cmd->pool);
> +	dma_pool_destroy(cmd->pool);
>  }
>  EXPORT_SYMBOL(mlx5_cmd_cleanup);
> diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
> index 2fcff6b..13a267c 100644
> --- a/include/linux/mlx5/driver.h
> +++ b/include/linux/mlx5/driver.h
> @@ -284,7 +284,7 @@ struct mlx5_cmd {
>  	struct semaphore pages_sem;
>  	int	mode;
>  	struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS];
> -	struct pci_pool *pool;
> +	struct dma_pool *pool;
>  	struct mlx5_cmd_debug dbg;
>  	struct cmd_msg_cache cache[MLX5_NUM_COMMAND_CACHES];
>  	int checksum_disabled;
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 07/20] wireless: ipw2200: Replace PCI pool old API
       [not found] ` <20170226192425.13098-8-romain.perier@collabora.com>
@ 2017-02-27 11:09       ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:09 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w, David S. Miller,
	stas.yakovlev-Re5JQEeQqe8AvxtiuMwx3w, James E.J. Bottomley,
	Martin K. Petersen, Felipe Balbi, Greg Kroah-Hartman,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:12PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> Signed-off-by: Romain Perier <romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> ---
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> index 5ef3c5c..93dfe47 100644
> --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> @@ -3211,7 +3211,7 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
>  	struct fw_chunk *chunk;
>  	int total_nr = 0;
>  	int i;
> -	struct pci_pool *pool;
> +	struct dma_pool *pool;
>  	void **virts;
>  	dma_addr_t *phys;
>  
> @@ -3228,9 +3228,10 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
>  		kfree(virts);
>  		return -ENOMEM;
>  	}
> -	pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0);
> +	pool = dma_pool_create("ipw2200", &priv->pci_dev->dev, CB_MAX_LENGTH, 0,
> +			       0);
>  	if (!pool) {
> -		IPW_ERROR("pci_pool_create failed\n");
> +		IPW_ERROR("dma_pool_create failed\n");
>  		kfree(phys);
>  		kfree(virts);
>  		return -ENOMEM;
> @@ -3255,7 +3256,7 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
>  
>  		nr = (chunk_len + CB_MAX_LENGTH - 1) / CB_MAX_LENGTH;
>  		for (i = 0; i < nr; i++) {
> -			virts[total_nr] = pci_pool_alloc(pool, GFP_KERNEL,
> +			virts[total_nr] = dma_pool_alloc(pool, GFP_KERNEL,
>  							 &phys[total_nr]);
>  			if (!virts[total_nr]) {
>  				ret = -ENOMEM;
> @@ -3299,9 +3300,9 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
>  	}
>   out:
>  	for (i = 0; i < total_nr; i++)
> -		pci_pool_free(pool, virts[i], phys[i]);
> +		dma_pool_free(pool, virts[i], phys[i]);
>  
> -	pci_pool_destroy(pool);
> +	dma_pool_destroy(pool);
>  	kfree(phys);
>  	kfree(virts);
>  
> -- 
> 2.9.3
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 07/20] wireless: ipw2200: Replace PCI pool old API
@ 2017-02-27 11:09       ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:09 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:12PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> index 5ef3c5c..93dfe47 100644
> --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> @@ -3211,7 +3211,7 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
>  	struct fw_chunk *chunk;
>  	int total_nr = 0;
>  	int i;
> -	struct pci_pool *pool;
> +	struct dma_pool *pool;
>  	void **virts;
>  	dma_addr_t *phys;
>  
> @@ -3228,9 +3228,10 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
>  		kfree(virts);
>  		return -ENOMEM;
>  	}
> -	pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0);
> +	pool = dma_pool_create("ipw2200", &priv->pci_dev->dev, CB_MAX_LENGTH, 0,
> +			       0);
>  	if (!pool) {
> -		IPW_ERROR("pci_pool_create failed\n");
> +		IPW_ERROR("dma_pool_create failed\n");
>  		kfree(phys);
>  		kfree(virts);
>  		return -ENOMEM;
> @@ -3255,7 +3256,7 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
>  
>  		nr = (chunk_len + CB_MAX_LENGTH - 1) / CB_MAX_LENGTH;
>  		for (i = 0; i < nr; i++) {
> -			virts[total_nr] = pci_pool_alloc(pool, GFP_KERNEL,
> +			virts[total_nr] = dma_pool_alloc(pool, GFP_KERNEL,
>  							 &phys[total_nr]);
>  			if (!virts[total_nr]) {
>  				ret = -ENOMEM;
> @@ -3299,9 +3300,9 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
>  	}
>   out:
>  	for (i = 0; i < total_nr; i++)
> -		pci_pool_free(pool, virts[i], phys[i]);
> +		dma_pool_free(pool, virts[i], phys[i]);
>  
> -	pci_pool_destroy(pool);
> +	dma_pool_destroy(pool);
>  	kfree(phys);
>  	kfree(virts);
>  
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 09/20] scsi: csiostor: Replace PCI pool old API
       [not found] ` <20170226192425.13098-10-romain.perier@collabora.com>
@ 2017-02-27 11:11       ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:11 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w, David S. Miller,
	stas.yakovlev-Re5JQEeQqe8AvxtiuMwx3w, James E.J. Bottomley,
	Martin K. Petersen, Felipe Balbi, Greg Kroah-Hartman,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:14PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API. It also updates
> the name of some variables and the content of comments, accordingly.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> Signed-off-by: Romain Perier <romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> ---
>  drivers/scsi/csiostor/csio_hw.h   |  2 +-
>  drivers/scsi/csiostor/csio_init.c | 11 ++++++-----
>  drivers/scsi/csiostor/csio_scsi.c |  6 +++---
>  3 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h
> index 029bef8..55b04fc 100644
> --- a/drivers/scsi/csiostor/csio_hw.h
> +++ b/drivers/scsi/csiostor/csio_hw.h
> @@ -465,7 +465,7 @@ struct csio_hw {
>  	struct csio_pport	pport[CSIO_MAX_PPORTS];	/* Ports (XGMACs) */
>  	struct csio_hw_params	params;			/* Hw parameters */
>  
> -	struct pci_pool		*scsi_pci_pool;		/* PCI pool for SCSI */
> +	struct dma_pool		*scsi_dma_pool;		/* DMA pool for SCSI */
>  	mempool_t		*mb_mempool;		/* Mailbox memory pool*/
>  	mempool_t		*rnode_mempool;		/* rnode memory pool */
>  
> diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c
> index dbe416f..292964c 100644
> --- a/drivers/scsi/csiostor/csio_init.c
> +++ b/drivers/scsi/csiostor/csio_init.c
> @@ -485,9 +485,10 @@ csio_resource_alloc(struct csio_hw *hw)
>  	if (!hw->rnode_mempool)
>  		goto err_free_mb_mempool;
>  
> -	hw->scsi_pci_pool = pci_pool_create("csio_scsi_pci_pool", hw->pdev,
> -					    CSIO_SCSI_RSP_LEN, 8, 0);
> -	if (!hw->scsi_pci_pool)
> +	hw->scsi_dma_pool = dma_pool_create("csio_scsi_dma_pool",
> +					    &hw->pdev->dev, CSIO_SCSI_RSP_LEN,
> +					    8, 0);
> +	if (!hw->scsi_dma_pool)
>  		goto err_free_rn_pool;
>  
>  	return 0;
> @@ -505,8 +506,8 @@ csio_resource_alloc(struct csio_hw *hw)
>  static void
>  csio_resource_free(struct csio_hw *hw)
>  {
> -	pci_pool_destroy(hw->scsi_pci_pool);
> -	hw->scsi_pci_pool = NULL;
> +	dma_pool_destroy(hw->scsi_dma_pool);
> +	hw->scsi_dma_pool = NULL;
>  	mempool_destroy(hw->rnode_mempool);
>  	hw->rnode_mempool = NULL;
>  	mempool_destroy(hw->mb_mempool);
> diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
> index a1ff75f..dab0d3f 100644
> --- a/drivers/scsi/csiostor/csio_scsi.c
> +++ b/drivers/scsi/csiostor/csio_scsi.c
> @@ -2445,7 +2445,7 @@ csio_scsim_init(struct csio_scsim *scm, struct csio_hw *hw)
>  
>  		/* Allocate Dma buffers for Response Payload */
>  		dma_buf = &ioreq->dma_buf;
> -		dma_buf->vaddr = pci_pool_alloc(hw->scsi_pci_pool, GFP_KERNEL,
> +		dma_buf->vaddr = dma_pool_alloc(hw->scsi_dma_pool, GFP_KERNEL,
>  						&dma_buf->paddr);
>  		if (!dma_buf->vaddr) {
>  			csio_err(hw,
> @@ -2485,7 +2485,7 @@ csio_scsim_init(struct csio_scsim *scm, struct csio_hw *hw)
>  		ioreq = (struct csio_ioreq *)tmp;
>  
>  		dma_buf = &ioreq->dma_buf;
> -		pci_pool_free(hw->scsi_pci_pool, dma_buf->vaddr,
> +		dma_pool_free(hw->scsi_dma_pool, dma_buf->vaddr,
>  			      dma_buf->paddr);
>  
>  		kfree(ioreq);
> @@ -2516,7 +2516,7 @@ csio_scsim_exit(struct csio_scsim *scm)
>  		ioreq = (struct csio_ioreq *)tmp;
>  
>  		dma_buf = &ioreq->dma_buf;
> -		pci_pool_free(scm->hw->scsi_pci_pool, dma_buf->vaddr,
> +		dma_pool_free(scm->hw->scsi_dma_pool, dma_buf->vaddr,
>  			      dma_buf->paddr);
>  
>  		kfree(ioreq);
> -- 
> 2.9.3
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 09/20] scsi: csiostor: Replace PCI pool old API
@ 2017-02-27 11:11       ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:11 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:14PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API. It also updates
> the name of some variables and the content of comments, accordingly.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  drivers/scsi/csiostor/csio_hw.h   |  2 +-
>  drivers/scsi/csiostor/csio_init.c | 11 ++++++-----
>  drivers/scsi/csiostor/csio_scsi.c |  6 +++---
>  3 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h
> index 029bef8..55b04fc 100644
> --- a/drivers/scsi/csiostor/csio_hw.h
> +++ b/drivers/scsi/csiostor/csio_hw.h
> @@ -465,7 +465,7 @@ struct csio_hw {
>  	struct csio_pport	pport[CSIO_MAX_PPORTS];	/* Ports (XGMACs) */
>  	struct csio_hw_params	params;			/* Hw parameters */
>  
> -	struct pci_pool		*scsi_pci_pool;		/* PCI pool for SCSI */
> +	struct dma_pool		*scsi_dma_pool;		/* DMA pool for SCSI */
>  	mempool_t		*mb_mempool;		/* Mailbox memory pool*/
>  	mempool_t		*rnode_mempool;		/* rnode memory pool */
>  
> diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c
> index dbe416f..292964c 100644
> --- a/drivers/scsi/csiostor/csio_init.c
> +++ b/drivers/scsi/csiostor/csio_init.c
> @@ -485,9 +485,10 @@ csio_resource_alloc(struct csio_hw *hw)
>  	if (!hw->rnode_mempool)
>  		goto err_free_mb_mempool;
>  
> -	hw->scsi_pci_pool = pci_pool_create("csio_scsi_pci_pool", hw->pdev,
> -					    CSIO_SCSI_RSP_LEN, 8, 0);
> -	if (!hw->scsi_pci_pool)
> +	hw->scsi_dma_pool = dma_pool_create("csio_scsi_dma_pool",
> +					    &hw->pdev->dev, CSIO_SCSI_RSP_LEN,
> +					    8, 0);
> +	if (!hw->scsi_dma_pool)
>  		goto err_free_rn_pool;
>  
>  	return 0;
> @@ -505,8 +506,8 @@ csio_resource_alloc(struct csio_hw *hw)
>  static void
>  csio_resource_free(struct csio_hw *hw)
>  {
> -	pci_pool_destroy(hw->scsi_pci_pool);
> -	hw->scsi_pci_pool = NULL;
> +	dma_pool_destroy(hw->scsi_dma_pool);
> +	hw->scsi_dma_pool = NULL;
>  	mempool_destroy(hw->rnode_mempool);
>  	hw->rnode_mempool = NULL;
>  	mempool_destroy(hw->mb_mempool);
> diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
> index a1ff75f..dab0d3f 100644
> --- a/drivers/scsi/csiostor/csio_scsi.c
> +++ b/drivers/scsi/csiostor/csio_scsi.c
> @@ -2445,7 +2445,7 @@ csio_scsim_init(struct csio_scsim *scm, struct csio_hw *hw)
>  
>  		/* Allocate Dma buffers for Response Payload */
>  		dma_buf = &ioreq->dma_buf;
> -		dma_buf->vaddr = pci_pool_alloc(hw->scsi_pci_pool, GFP_KERNEL,
> +		dma_buf->vaddr = dma_pool_alloc(hw->scsi_dma_pool, GFP_KERNEL,
>  						&dma_buf->paddr);
>  		if (!dma_buf->vaddr) {
>  			csio_err(hw,
> @@ -2485,7 +2485,7 @@ csio_scsim_init(struct csio_scsim *scm, struct csio_hw *hw)
>  		ioreq = (struct csio_ioreq *)tmp;
>  
>  		dma_buf = &ioreq->dma_buf;
> -		pci_pool_free(hw->scsi_pci_pool, dma_buf->vaddr,
> +		dma_pool_free(hw->scsi_dma_pool, dma_buf->vaddr,
>  			      dma_buf->paddr);
>  
>  		kfree(ioreq);
> @@ -2516,7 +2516,7 @@ csio_scsim_exit(struct csio_scsim *scm)
>  		ioreq = (struct csio_ioreq *)tmp;
>  
>  		dma_buf = &ioreq->dma_buf;
> -		pci_pool_free(scm->hw->scsi_pci_pool, dma_buf->vaddr,
> +		dma_pool_free(scm->hw->scsi_dma_pool, dma_buf->vaddr,
>  			      dma_buf->paddr);
>  
>  		kfree(ioreq);
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 10/20] scsi: lpfc: Replace PCI pool old API
       [not found] ` <20170226192425.13098-11-romain.perier@collabora.com>
@ 2017-02-27 11:13       ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:13 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w, David S. Miller,
	stas.yakovlev-Re5JQEeQqe8AvxtiuMwx3w, James E.J. Bottomley,
	Martin K. Petersen, Felipe Balbi, Greg Kroah-Hartman,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:15PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API. It also updates
> some comments, accordingly.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> Signed-off-by: Romain Perier <romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> ---
>  drivers/scsi/lpfc/lpfc.h       |  12 ++---
>  drivers/scsi/lpfc/lpfc_init.c  |  16 +++----
>  drivers/scsi/lpfc/lpfc_mem.c   | 105 ++++++++++++++++++++---------------------
>  drivers/scsi/lpfc/lpfc_nvme.c  |   6 +--
>  drivers/scsi/lpfc/lpfc_nvmet.c |   4 +-
>  drivers/scsi/lpfc/lpfc_scsi.c  |  12 ++---
>  6 files changed, 76 insertions(+), 79 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
> index 0bba2e3..29492bc 100644
> --- a/drivers/scsi/lpfc/lpfc.h
> +++ b/drivers/scsi/lpfc/lpfc.h
> @@ -934,12 +934,12 @@ struct lpfc_hba {
>  	spinlock_t hbalock;
>  
>  	/* pci_mem_pools */
> -	struct pci_pool *lpfc_sg_dma_buf_pool;
> -	struct pci_pool *lpfc_mbuf_pool;
> -	struct pci_pool *lpfc_hrb_pool;	/* header receive buffer pool */
> -	struct pci_pool *lpfc_drb_pool; /* data receive buffer pool */
> -	struct pci_pool *lpfc_hbq_pool;	/* SLI3 hbq buffer pool */
> -	struct pci_pool *txrdy_payload_pool;
> +	struct dma_pool *lpfc_sg_dma_buf_pool;
> +	struct dma_pool *lpfc_mbuf_pool;
> +	struct dma_pool *lpfc_hrb_pool;	/* header receive buffer pool */
> +	struct dma_pool *lpfc_drb_pool; /* data receive buffer pool */
> +	struct dma_pool *lpfc_hbq_pool;	/* SLI3 hbq buffer pool */
> +	struct dma_pool *txrdy_payload_pool;
>  	struct lpfc_dma_pool lpfc_mbuf_safety_pool;
>  
>  	mempool_t *mbox_mem_pool;
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index 0ee429d..b856457 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -3151,7 +3151,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
>  	list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put,
>  				 list) {
>  		list_del(&sb->list);
> -		pci_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
> +		dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
>  			      sb->dma_handle);
>  		kfree(sb);
>  		phba->total_scsi_bufs--;
> @@ -3162,7 +3162,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
>  	list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get,
>  				 list) {
>  		list_del(&sb->list);
> -		pci_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
> +		dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
>  			      sb->dma_handle);
>  		kfree(sb);
>  		phba->total_scsi_bufs--;
> @@ -3193,7 +3193,7 @@ lpfc_nvme_free(struct lpfc_hba *phba)
>  	list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next,
>  				 &phba->lpfc_nvme_buf_list_put, list) {
>  		list_del(&lpfc_ncmd->list);
> -		pci_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
> +		dma_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
>  			      lpfc_ncmd->dma_handle);
>  		kfree(lpfc_ncmd);
>  		phba->total_nvme_bufs--;
> @@ -3204,7 +3204,7 @@ lpfc_nvme_free(struct lpfc_hba *phba)
>  	list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next,
>  				 &phba->lpfc_nvme_buf_list_get, list) {
>  		list_del(&lpfc_ncmd->list);
> -		pci_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
> +		dma_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
>  			      lpfc_ncmd->dma_handle);
>  		kfree(lpfc_ncmd);
>  		phba->total_nvme_bufs--;
> @@ -3517,7 +3517,7 @@ lpfc_sli4_scsi_sgl_update(struct lpfc_hba *phba)
>  			list_remove_head(&scsi_sgl_list, psb,
>  					 struct lpfc_scsi_buf, list);
>  			if (psb) {
> -				pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +				dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  					      psb->data, psb->dma_handle);
>  				kfree(psb);
>  			}
> @@ -3614,7 +3614,7 @@ lpfc_sli4_nvme_sgl_update(struct lpfc_hba *phba)
>  			list_remove_head(&nvme_sgl_list, lpfc_ncmd,
>  					 struct lpfc_nvme_buf, list);
>  			if (lpfc_ncmd) {
> -				pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +				dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  					      lpfc_ncmd->data,
>  					      lpfc_ncmd->dma_handle);
>  				kfree(lpfc_ncmd);
> @@ -6629,8 +6629,8 @@ lpfc_create_shost(struct lpfc_hba *phba)
>  	if (phba->nvmet_support) {
>  		/* Only 1 vport (pport) will support NVME target */
>  		if (phba->txrdy_payload_pool == NULL) {
> -			phba->txrdy_payload_pool = pci_pool_create(
> -				"txrdy_pool", phba->pcidev,
> +			phba->txrdy_payload_pool = dma_pool_create(
> +				"txrdy_pool", &phba->pcidev->dev,
>  				TXRDY_PAYLOAD_LEN, 16, 0);
>  			if (phba->txrdy_payload_pool) {
>  				phba->targetport = NULL;
> diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
> index c61d8d6..49dce0c 100644
> --- a/drivers/scsi/lpfc/lpfc_mem.c
> +++ b/drivers/scsi/lpfc/lpfc_mem.c
> @@ -97,8 +97,8 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  			i = SLI4_PAGE_SIZE;
>  
>  		phba->lpfc_sg_dma_buf_pool =
> -			pci_pool_create("lpfc_sg_dma_buf_pool",
> -					phba->pcidev,
> +			dma_pool_create("lpfc_sg_dma_buf_pool",
> +					&phba->pcidev->dev,
>  					phba->cfg_sg_dma_buf_size,
>  					i, 0);
>  		if (!phba->lpfc_sg_dma_buf_pool)
> @@ -106,17 +106,18 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  
>  	} else {
>  		phba->lpfc_sg_dma_buf_pool =
> -			pci_pool_create("lpfc_sg_dma_buf_pool",
> -					phba->pcidev, phba->cfg_sg_dma_buf_size,
> +			dma_pool_create("lpfc_sg_dma_buf_pool",
> +					&phba->pcidev->dev,
> +					phba->cfg_sg_dma_buf_size,
>  					align, 0);
>  
>  		if (!phba->lpfc_sg_dma_buf_pool)
>  			goto fail;
>  	}
>  
> -	phba->lpfc_mbuf_pool = pci_pool_create("lpfc_mbuf_pool", phba->pcidev,
> -							LPFC_BPL_SIZE,
> -							align, 0);
> +	phba->lpfc_mbuf_pool = dma_pool_create("lpfc_mbuf_pool",
> +					       &phba->pcidev->dev,
> +					       LPFC_BPL_SIZE, align, 0);
>  	if (!phba->lpfc_mbuf_pool)
>  		goto fail_free_dma_buf_pool;
>  
> @@ -128,7 +129,7 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  	pool->max_count = 0;
>  	pool->current_count = 0;
>  	for ( i = 0; i < LPFC_MBUF_POOL_SIZE; i++) {
> -		pool->elements[i].virt = pci_pool_alloc(phba->lpfc_mbuf_pool,
> +		pool->elements[i].virt = dma_pool_alloc(phba->lpfc_mbuf_pool,
>  				       GFP_KERNEL, &pool->elements[i].phys);
>  		if (!pool->elements[i].virt)
>  			goto fail_free_mbuf_pool;
> @@ -152,21 +153,21 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  						sizeof(struct lpfc_node_rrq));
>  		if (!phba->rrq_pool)
>  			goto fail_free_nlp_mem_pool;
> -		phba->lpfc_hrb_pool = pci_pool_create("lpfc_hrb_pool",
> -					      phba->pcidev,
> +		phba->lpfc_hrb_pool = dma_pool_create("lpfc_hrb_pool",
> +					      &phba->pcidev->dev,
>  					      LPFC_HDR_BUF_SIZE, align, 0);
>  		if (!phba->lpfc_hrb_pool)
>  			goto fail_free_rrq_mem_pool;
>  
> -		phba->lpfc_drb_pool = pci_pool_create("lpfc_drb_pool",
> -					      phba->pcidev,
> +		phba->lpfc_drb_pool = dma_pool_create("lpfc_drb_pool",
> +					      &phba->pcidev->dev,
>  					      LPFC_DATA_BUF_SIZE, align, 0);
>  		if (!phba->lpfc_drb_pool)
>  			goto fail_free_hrb_pool;
>  		phba->lpfc_hbq_pool = NULL;
>  	} else {
> -		phba->lpfc_hbq_pool = pci_pool_create("lpfc_hbq_pool",
> -			phba->pcidev, LPFC_BPL_SIZE, align, 0);
> +		phba->lpfc_hbq_pool = dma_pool_create("lpfc_hbq_pool",
> +			&phba->pcidev->dev, LPFC_BPL_SIZE, align, 0);
>  		if (!phba->lpfc_hbq_pool)
>  			goto fail_free_nlp_mem_pool;
>  		phba->lpfc_hrb_pool = NULL;
> @@ -185,10 +186,10 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  
>  	return 0;
>  fail_free_drb_pool:
> -	pci_pool_destroy(phba->lpfc_drb_pool);
> +	dma_pool_destroy(phba->lpfc_drb_pool);
>  	phba->lpfc_drb_pool = NULL;
>   fail_free_hrb_pool:
> -	pci_pool_destroy(phba->lpfc_hrb_pool);
> +	dma_pool_destroy(phba->lpfc_hrb_pool);
>  	phba->lpfc_hrb_pool = NULL;
>   fail_free_rrq_mem_pool:
>  	mempool_destroy(phba->rrq_pool);
> @@ -201,14 +202,14 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  	phba->mbox_mem_pool = NULL;
>   fail_free_mbuf_pool:
>  	while (i--)
> -		pci_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
> +		dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
>  						 pool->elements[i].phys);
>  	kfree(pool->elements);
>   fail_free_lpfc_mbuf_pool:
> -	pci_pool_destroy(phba->lpfc_mbuf_pool);
> +	dma_pool_destroy(phba->lpfc_mbuf_pool);
>  	phba->lpfc_mbuf_pool = NULL;
>   fail_free_dma_buf_pool:
> -	pci_pool_destroy(phba->lpfc_sg_dma_buf_pool);
> +	dma_pool_destroy(phba->lpfc_sg_dma_buf_pool);
>  	phba->lpfc_sg_dma_buf_pool = NULL;
>   fail:
>  	return -ENOMEM;
> @@ -232,18 +233,14 @@ lpfc_mem_free(struct lpfc_hba *phba)
>  
>  	/* Free HBQ pools */
>  	lpfc_sli_hbqbuf_free_all(phba);
> -	if (phba->lpfc_drb_pool)
> -		pci_pool_destroy(phba->lpfc_drb_pool);
> +	dma_pool_destroy(phba->lpfc_drb_pool);
>  	phba->lpfc_drb_pool = NULL;
> -	if (phba->lpfc_hrb_pool)
> -		pci_pool_destroy(phba->lpfc_hrb_pool);
> +	dma_pool_destroy(phba->lpfc_hrb_pool);
>  	phba->lpfc_hrb_pool = NULL;
> -	if (phba->txrdy_payload_pool)
> -		pci_pool_destroy(phba->txrdy_payload_pool);
> +	dma_pool_destroy(phba->txrdy_payload_pool);
>  	phba->txrdy_payload_pool = NULL;
>  
> -	if (phba->lpfc_hbq_pool)
> -		pci_pool_destroy(phba->lpfc_hbq_pool);
> +	dma_pool_destroy(phba->lpfc_hbq_pool);
>  	phba->lpfc_hbq_pool = NULL;
>  
>  	if (phba->rrq_pool)
> @@ -264,15 +261,15 @@ lpfc_mem_free(struct lpfc_hba *phba)
>  
>  	/* Free MBUF memory pool */
>  	for (i = 0; i < pool->current_count; i++)
> -		pci_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
> +		dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
>  			      pool->elements[i].phys);
>  	kfree(pool->elements);
>  
> -	pci_pool_destroy(phba->lpfc_mbuf_pool);
> +	dma_pool_destroy(phba->lpfc_mbuf_pool);
>  	phba->lpfc_mbuf_pool = NULL;
>  
>  	/* Free DMA buffer memory pool */
> -	pci_pool_destroy(phba->lpfc_sg_dma_buf_pool);
> +	dma_pool_destroy(phba->lpfc_sg_dma_buf_pool);
>  	phba->lpfc_sg_dma_buf_pool = NULL;
>  
>  	/* Free Device Data memory pool */
> @@ -361,7 +358,7 @@ lpfc_mem_free_all(struct lpfc_hba *phba)
>   * @handle: used to return the DMA-mapped address of the mbuf
>   *
>   * Description: Allocates a DMA-mapped buffer from the lpfc_mbuf_pool PCI pool.
> - * Allocates from generic pci_pool_alloc function first and if that fails and
> + * Allocates from generic dma_pool_alloc function first and if that fails and
>   * mem_flags has MEM_PRI set (the only defined flag), returns an mbuf from the
>   * HBA's pool.
>   *
> @@ -379,7 +376,7 @@ lpfc_mbuf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle)
>  	unsigned long iflags;
>  	void *ret;
>  
> -	ret = pci_pool_alloc(phba->lpfc_mbuf_pool, GFP_KERNEL, handle);
> +	ret = dma_pool_alloc(phba->lpfc_mbuf_pool, GFP_KERNEL, handle);
>  
>  	spin_lock_irqsave(&phba->hbalock, iflags);
>  	if (!ret && (mem_flags & MEM_PRI) && pool->current_count) {
> @@ -415,7 +412,7 @@ __lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
>  		pool->elements[pool->current_count].phys = dma;
>  		pool->current_count++;
>  	} else {
> -		pci_pool_free(phba->lpfc_mbuf_pool, virt, dma);
> +		dma_pool_free(phba->lpfc_mbuf_pool, virt, dma);
>  	}
>  	return;
>  }
> @@ -452,7 +449,7 @@ lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
>   * @handle: used to return the DMA-mapped address of the nvmet_buf
>   *
>   * Description: Allocates a DMA-mapped buffer from the lpfc_sg_dma_buf_pool
> - * PCI pool.  Allocates from generic pci_pool_alloc function.
> + * PCI pool.  Allocates from generic dma_pool_alloc function.
>   *
>   * Returns:
>   *   pointer to the allocated nvmet_buf on success
> @@ -463,7 +460,7 @@ lpfc_nvmet_buf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle)
>  {
>  	void *ret;
>  
> -	ret = pci_pool_alloc(phba->lpfc_sg_dma_buf_pool, GFP_KERNEL, handle);
> +	ret = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool, GFP_KERNEL, handle);
>  	return ret;
>  }
>  
> @@ -479,7 +476,7 @@ lpfc_nvmet_buf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle)
>  void
>  lpfc_nvmet_buf_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma)
>  {
> -	pci_pool_free(phba->lpfc_sg_dma_buf_pool, virt, dma);
> +	dma_pool_free(phba->lpfc_sg_dma_buf_pool, virt, dma);
>  }
>  
>  /**
> @@ -504,7 +501,7 @@ lpfc_els_hbq_alloc(struct lpfc_hba *phba)
>  	if (!hbqbp)
>  		return NULL;
>  
> -	hbqbp->dbuf.virt = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL,
> +	hbqbp->dbuf.virt = dma_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL,
>  					  &hbqbp->dbuf.phys);
>  	if (!hbqbp->dbuf.virt) {
>  		kfree(hbqbp);
> @@ -529,7 +526,7 @@ lpfc_els_hbq_alloc(struct lpfc_hba *phba)
>  void
>  lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp)
>  {
> -	pci_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys);
> +	dma_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys);
>  	kfree(hbqbp);
>  	return;
>  }
> @@ -556,16 +553,16 @@ lpfc_sli4_rb_alloc(struct lpfc_hba *phba)
>  	if (!dma_buf)
>  		return NULL;
>  
> -	dma_buf->hbuf.virt = pci_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
> +	dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
>  					    &dma_buf->hbuf.phys);
>  	if (!dma_buf->hbuf.virt) {
>  		kfree(dma_buf);
>  		return NULL;
>  	}
> -	dma_buf->dbuf.virt = pci_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
> +	dma_buf->dbuf.virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
>  					    &dma_buf->dbuf.phys);
>  	if (!dma_buf->dbuf.virt) {
> -		pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
> +		dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
>  			      dma_buf->hbuf.phys);
>  		kfree(dma_buf);
>  		return NULL;
> @@ -589,8 +586,8 @@ lpfc_sli4_rb_alloc(struct lpfc_hba *phba)
>  void
>  lpfc_sli4_rb_free(struct lpfc_hba *phba, struct hbq_dmabuf *dmab)
>  {
> -	pci_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
> -	pci_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys);
> +	dma_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
> +	dma_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys);
>  	kfree(dmab);
>  }
>  
> @@ -618,16 +615,16 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
>  	if (!dma_buf)
>  		return NULL;
>  
> -	dma_buf->hbuf.virt = pci_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
> +	dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
>  					    &dma_buf->hbuf.phys);
>  	if (!dma_buf->hbuf.virt) {
>  		kfree(dma_buf);
>  		return NULL;
>  	}
> -	dma_buf->dbuf.virt = pci_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
> +	dma_buf->dbuf.virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
>  					    &dma_buf->dbuf.phys);
>  	if (!dma_buf->dbuf.virt) {
> -		pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
> +		dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
>  			      dma_buf->hbuf.phys);
>  		kfree(dma_buf);
>  		return NULL;
> @@ -637,9 +634,9 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
>  	dma_buf->context = kzalloc(sizeof(struct lpfc_nvmet_rcv_ctx),
>  				   GFP_KERNEL);
>  	if (!dma_buf->context) {
> -		pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
> +		dma_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
>  			      dma_buf->dbuf.phys);
> -		pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
> +		dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
>  			      dma_buf->hbuf.phys);
>  		kfree(dma_buf);
>  		return NULL;
> @@ -649,9 +646,9 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
>  	dma_buf->iocbq->iocb_flag = LPFC_IO_NVMET;
>  	if (!dma_buf->iocbq) {
>  		kfree(dma_buf->context);
> -		pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
> +		dma_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
>  			      dma_buf->dbuf.phys);
> -		pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
> +		dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
>  			      dma_buf->hbuf.phys);
>  		kfree(dma_buf);
>  		lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
> @@ -678,9 +675,9 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
>  	if (!dma_buf->sglq) {
>  		lpfc_sli_release_iocbq(phba, dma_buf->iocbq);
>  		kfree(dma_buf->context);
> -		pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
> +		dma_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
>  			      dma_buf->dbuf.phys);
> -		pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
> +		dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
>  			      dma_buf->hbuf.phys);
>  		kfree(dma_buf);
>  		lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
> @@ -717,8 +714,8 @@ lpfc_sli4_nvmet_free(struct lpfc_hba *phba, struct rqb_dmabuf *dmab)
>  
>  	lpfc_sli_release_iocbq(phba, dmab->iocbq);
>  	kfree(dmab->context);
> -	pci_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
> -	pci_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys);
> +	dma_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
> +	dma_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys);
>  	kfree(dmab);
>  }
>  
> diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
> index 625b658..0b38a5e 100644
> --- a/drivers/scsi/lpfc/lpfc_nvme.c
> +++ b/drivers/scsi/lpfc/lpfc_nvme.c
> @@ -1950,7 +1950,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc)
>  		 * pci bus space for an I/O. The DMA buffer includes the
>  		 * number of SGE's necessary to support the sg_tablesize.
>  		 */
> -		lpfc_ncmd->data = pci_pool_alloc(phba->lpfc_sg_dma_buf_pool,
> +		lpfc_ncmd->data = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool,
>  						 GFP_KERNEL,
>  						 &lpfc_ncmd->dma_handle);
>  		if (!lpfc_ncmd->data) {
> @@ -1961,7 +1961,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc)
>  
>  		lxri = lpfc_sli4_next_xritag(phba);
>  		if (lxri == NO_XRI) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      lpfc_ncmd->data, lpfc_ncmd->dma_handle);
>  			kfree(lpfc_ncmd);
>  			break;
> @@ -1972,7 +1972,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc)
>  		/* Allocate iotag for lpfc_ncmd->cur_iocbq. */
>  		iotag = lpfc_sli_next_iotag(phba, pwqeq);
>  		if (iotag == 0) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      lpfc_ncmd->data, lpfc_ncmd->dma_handle);
>  			kfree(lpfc_ncmd);
>  			lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
> diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
> index c421e17..a446c52 100644
> --- a/drivers/scsi/lpfc/lpfc_nvmet.c
> +++ b/drivers/scsi/lpfc/lpfc_nvmet.c
> @@ -140,7 +140,7 @@ lpfc_nvmet_rq_post(struct lpfc_hba *phba, struct lpfc_nvmet_rcv_ctx *ctxp,
>  {
>  	if (ctxp) {
>  		if (ctxp->txrdy) {
> -			pci_pool_free(phba->txrdy_payload_pool, ctxp->txrdy,
> +			dma_pool_free(phba->txrdy_payload_pool, ctxp->txrdy,
>  				      ctxp->txrdy_phys);
>  			ctxp->txrdy = NULL;
>  			ctxp->txrdy_phys = 0;
> @@ -1353,7 +1353,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
>  
>  	case NVMET_FCOP_WRITEDATA:
>  		/* Words 0 - 2 : The first sg segment */
> -		txrdy = pci_pool_alloc(phba->txrdy_payload_pool,
> +		txrdy = dma_pool_alloc(phba->txrdy_payload_pool,
>  				       GFP_KERNEL, &physaddr);
>  		if (!txrdy) {
>  			lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
> diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
> index 9d6384a..b3a4238 100644
> --- a/drivers/scsi/lpfc/lpfc_scsi.c
> +++ b/drivers/scsi/lpfc/lpfc_scsi.c
> @@ -415,7 +415,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_to_alloc)
>  		 * struct fcp_cmnd, struct fcp_rsp and the number of bde's
>  		 * necessary to support the sg_tablesize.
>  		 */
> -		psb->data = pci_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
> +		psb->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
>  					GFP_KERNEL, &psb->dma_handle);
>  		if (!psb->data) {
>  			kfree(psb);
> @@ -426,7 +426,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_to_alloc)
>  		/* Allocate iotag for psb->cur_iocbq. */
>  		iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq);
>  		if (iotag == 0) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      psb->data, psb->dma_handle);
>  			kfree(psb);
>  			break;
> @@ -825,7 +825,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
>  		 * for the struct fcp_cmnd, struct fcp_rsp and the number
>  		 * of bde's necessary to support the sg_tablesize.
>  		 */
> -		psb->data = pci_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
> +		psb->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
>  						GFP_KERNEL, &psb->dma_handle);
>  		if (!psb->data) {
>  			kfree(psb);
> @@ -838,7 +838,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
>  		 */
>  		if (phba->cfg_enable_bg  && (((unsigned long)(psb->data) &
>  		    (unsigned long)(SLI4_PAGE_SIZE - 1)) != 0)) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      psb->data, psb->dma_handle);
>  			kfree(psb);
>  			break;
> @@ -847,7 +847,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
>  
>  		lxri = lpfc_sli4_next_xritag(phba);
>  		if (lxri == NO_XRI) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      psb->data, psb->dma_handle);
>  			kfree(psb);
>  			break;
> @@ -856,7 +856,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
>  		/* Allocate iotag for psb->cur_iocbq. */
>  		iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq);
>  		if (iotag == 0) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      psb->data, psb->dma_handle);
>  			kfree(psb);
>  			lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
> -- 
> 2.9.3
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 10/20] scsi: lpfc: Replace PCI pool old API
@ 2017-02-27 11:13       ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:13 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:15PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API. It also updates
> some comments, accordingly.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  drivers/scsi/lpfc/lpfc.h       |  12 ++---
>  drivers/scsi/lpfc/lpfc_init.c  |  16 +++----
>  drivers/scsi/lpfc/lpfc_mem.c   | 105 ++++++++++++++++++++---------------------
>  drivers/scsi/lpfc/lpfc_nvme.c  |   6 +--
>  drivers/scsi/lpfc/lpfc_nvmet.c |   4 +-
>  drivers/scsi/lpfc/lpfc_scsi.c  |  12 ++---
>  6 files changed, 76 insertions(+), 79 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
> index 0bba2e3..29492bc 100644
> --- a/drivers/scsi/lpfc/lpfc.h
> +++ b/drivers/scsi/lpfc/lpfc.h
> @@ -934,12 +934,12 @@ struct lpfc_hba {
>  	spinlock_t hbalock;
>  
>  	/* pci_mem_pools */
> -	struct pci_pool *lpfc_sg_dma_buf_pool;
> -	struct pci_pool *lpfc_mbuf_pool;
> -	struct pci_pool *lpfc_hrb_pool;	/* header receive buffer pool */
> -	struct pci_pool *lpfc_drb_pool; /* data receive buffer pool */
> -	struct pci_pool *lpfc_hbq_pool;	/* SLI3 hbq buffer pool */
> -	struct pci_pool *txrdy_payload_pool;
> +	struct dma_pool *lpfc_sg_dma_buf_pool;
> +	struct dma_pool *lpfc_mbuf_pool;
> +	struct dma_pool *lpfc_hrb_pool;	/* header receive buffer pool */
> +	struct dma_pool *lpfc_drb_pool; /* data receive buffer pool */
> +	struct dma_pool *lpfc_hbq_pool;	/* SLI3 hbq buffer pool */
> +	struct dma_pool *txrdy_payload_pool;
>  	struct lpfc_dma_pool lpfc_mbuf_safety_pool;
>  
>  	mempool_t *mbox_mem_pool;
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index 0ee429d..b856457 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -3151,7 +3151,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
>  	list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put,
>  				 list) {
>  		list_del(&sb->list);
> -		pci_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
> +		dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
>  			      sb->dma_handle);
>  		kfree(sb);
>  		phba->total_scsi_bufs--;
> @@ -3162,7 +3162,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
>  	list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get,
>  				 list) {
>  		list_del(&sb->list);
> -		pci_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
> +		dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
>  			      sb->dma_handle);
>  		kfree(sb);
>  		phba->total_scsi_bufs--;
> @@ -3193,7 +3193,7 @@ lpfc_nvme_free(struct lpfc_hba *phba)
>  	list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next,
>  				 &phba->lpfc_nvme_buf_list_put, list) {
>  		list_del(&lpfc_ncmd->list);
> -		pci_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
> +		dma_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
>  			      lpfc_ncmd->dma_handle);
>  		kfree(lpfc_ncmd);
>  		phba->total_nvme_bufs--;
> @@ -3204,7 +3204,7 @@ lpfc_nvme_free(struct lpfc_hba *phba)
>  	list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next,
>  				 &phba->lpfc_nvme_buf_list_get, list) {
>  		list_del(&lpfc_ncmd->list);
> -		pci_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
> +		dma_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
>  			      lpfc_ncmd->dma_handle);
>  		kfree(lpfc_ncmd);
>  		phba->total_nvme_bufs--;
> @@ -3517,7 +3517,7 @@ lpfc_sli4_scsi_sgl_update(struct lpfc_hba *phba)
>  			list_remove_head(&scsi_sgl_list, psb,
>  					 struct lpfc_scsi_buf, list);
>  			if (psb) {
> -				pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +				dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  					      psb->data, psb->dma_handle);
>  				kfree(psb);
>  			}
> @@ -3614,7 +3614,7 @@ lpfc_sli4_nvme_sgl_update(struct lpfc_hba *phba)
>  			list_remove_head(&nvme_sgl_list, lpfc_ncmd,
>  					 struct lpfc_nvme_buf, list);
>  			if (lpfc_ncmd) {
> -				pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +				dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  					      lpfc_ncmd->data,
>  					      lpfc_ncmd->dma_handle);
>  				kfree(lpfc_ncmd);
> @@ -6629,8 +6629,8 @@ lpfc_create_shost(struct lpfc_hba *phba)
>  	if (phba->nvmet_support) {
>  		/* Only 1 vport (pport) will support NVME target */
>  		if (phba->txrdy_payload_pool == NULL) {
> -			phba->txrdy_payload_pool = pci_pool_create(
> -				"txrdy_pool", phba->pcidev,
> +			phba->txrdy_payload_pool = dma_pool_create(
> +				"txrdy_pool", &phba->pcidev->dev,
>  				TXRDY_PAYLOAD_LEN, 16, 0);
>  			if (phba->txrdy_payload_pool) {
>  				phba->targetport = NULL;
> diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
> index c61d8d6..49dce0c 100644
> --- a/drivers/scsi/lpfc/lpfc_mem.c
> +++ b/drivers/scsi/lpfc/lpfc_mem.c
> @@ -97,8 +97,8 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  			i = SLI4_PAGE_SIZE;
>  
>  		phba->lpfc_sg_dma_buf_pool =
> -			pci_pool_create("lpfc_sg_dma_buf_pool",
> -					phba->pcidev,
> +			dma_pool_create("lpfc_sg_dma_buf_pool",
> +					&phba->pcidev->dev,
>  					phba->cfg_sg_dma_buf_size,
>  					i, 0);
>  		if (!phba->lpfc_sg_dma_buf_pool)
> @@ -106,17 +106,18 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  
>  	} else {
>  		phba->lpfc_sg_dma_buf_pool =
> -			pci_pool_create("lpfc_sg_dma_buf_pool",
> -					phba->pcidev, phba->cfg_sg_dma_buf_size,
> +			dma_pool_create("lpfc_sg_dma_buf_pool",
> +					&phba->pcidev->dev,
> +					phba->cfg_sg_dma_buf_size,
>  					align, 0);
>  
>  		if (!phba->lpfc_sg_dma_buf_pool)
>  			goto fail;
>  	}
>  
> -	phba->lpfc_mbuf_pool = pci_pool_create("lpfc_mbuf_pool", phba->pcidev,
> -							LPFC_BPL_SIZE,
> -							align, 0);
> +	phba->lpfc_mbuf_pool = dma_pool_create("lpfc_mbuf_pool",
> +					       &phba->pcidev->dev,
> +					       LPFC_BPL_SIZE, align, 0);
>  	if (!phba->lpfc_mbuf_pool)
>  		goto fail_free_dma_buf_pool;
>  
> @@ -128,7 +129,7 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  	pool->max_count = 0;
>  	pool->current_count = 0;
>  	for ( i = 0; i < LPFC_MBUF_POOL_SIZE; i++) {
> -		pool->elements[i].virt = pci_pool_alloc(phba->lpfc_mbuf_pool,
> +		pool->elements[i].virt = dma_pool_alloc(phba->lpfc_mbuf_pool,
>  				       GFP_KERNEL, &pool->elements[i].phys);
>  		if (!pool->elements[i].virt)
>  			goto fail_free_mbuf_pool;
> @@ -152,21 +153,21 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  						sizeof(struct lpfc_node_rrq));
>  		if (!phba->rrq_pool)
>  			goto fail_free_nlp_mem_pool;
> -		phba->lpfc_hrb_pool = pci_pool_create("lpfc_hrb_pool",
> -					      phba->pcidev,
> +		phba->lpfc_hrb_pool = dma_pool_create("lpfc_hrb_pool",
> +					      &phba->pcidev->dev,
>  					      LPFC_HDR_BUF_SIZE, align, 0);
>  		if (!phba->lpfc_hrb_pool)
>  			goto fail_free_rrq_mem_pool;
>  
> -		phba->lpfc_drb_pool = pci_pool_create("lpfc_drb_pool",
> -					      phba->pcidev,
> +		phba->lpfc_drb_pool = dma_pool_create("lpfc_drb_pool",
> +					      &phba->pcidev->dev,
>  					      LPFC_DATA_BUF_SIZE, align, 0);
>  		if (!phba->lpfc_drb_pool)
>  			goto fail_free_hrb_pool;
>  		phba->lpfc_hbq_pool = NULL;
>  	} else {
> -		phba->lpfc_hbq_pool = pci_pool_create("lpfc_hbq_pool",
> -			phba->pcidev, LPFC_BPL_SIZE, align, 0);
> +		phba->lpfc_hbq_pool = dma_pool_create("lpfc_hbq_pool",
> +			&phba->pcidev->dev, LPFC_BPL_SIZE, align, 0);
>  		if (!phba->lpfc_hbq_pool)
>  			goto fail_free_nlp_mem_pool;
>  		phba->lpfc_hrb_pool = NULL;
> @@ -185,10 +186,10 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  
>  	return 0;
>  fail_free_drb_pool:
> -	pci_pool_destroy(phba->lpfc_drb_pool);
> +	dma_pool_destroy(phba->lpfc_drb_pool);
>  	phba->lpfc_drb_pool = NULL;
>   fail_free_hrb_pool:
> -	pci_pool_destroy(phba->lpfc_hrb_pool);
> +	dma_pool_destroy(phba->lpfc_hrb_pool);
>  	phba->lpfc_hrb_pool = NULL;
>   fail_free_rrq_mem_pool:
>  	mempool_destroy(phba->rrq_pool);
> @@ -201,14 +202,14 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>  	phba->mbox_mem_pool = NULL;
>   fail_free_mbuf_pool:
>  	while (i--)
> -		pci_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
> +		dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
>  						 pool->elements[i].phys);
>  	kfree(pool->elements);
>   fail_free_lpfc_mbuf_pool:
> -	pci_pool_destroy(phba->lpfc_mbuf_pool);
> +	dma_pool_destroy(phba->lpfc_mbuf_pool);
>  	phba->lpfc_mbuf_pool = NULL;
>   fail_free_dma_buf_pool:
> -	pci_pool_destroy(phba->lpfc_sg_dma_buf_pool);
> +	dma_pool_destroy(phba->lpfc_sg_dma_buf_pool);
>  	phba->lpfc_sg_dma_buf_pool = NULL;
>   fail:
>  	return -ENOMEM;
> @@ -232,18 +233,14 @@ lpfc_mem_free(struct lpfc_hba *phba)
>  
>  	/* Free HBQ pools */
>  	lpfc_sli_hbqbuf_free_all(phba);
> -	if (phba->lpfc_drb_pool)
> -		pci_pool_destroy(phba->lpfc_drb_pool);
> +	dma_pool_destroy(phba->lpfc_drb_pool);
>  	phba->lpfc_drb_pool = NULL;
> -	if (phba->lpfc_hrb_pool)
> -		pci_pool_destroy(phba->lpfc_hrb_pool);
> +	dma_pool_destroy(phba->lpfc_hrb_pool);
>  	phba->lpfc_hrb_pool = NULL;
> -	if (phba->txrdy_payload_pool)
> -		pci_pool_destroy(phba->txrdy_payload_pool);
> +	dma_pool_destroy(phba->txrdy_payload_pool);
>  	phba->txrdy_payload_pool = NULL;
>  
> -	if (phba->lpfc_hbq_pool)
> -		pci_pool_destroy(phba->lpfc_hbq_pool);
> +	dma_pool_destroy(phba->lpfc_hbq_pool);
>  	phba->lpfc_hbq_pool = NULL;
>  
>  	if (phba->rrq_pool)
> @@ -264,15 +261,15 @@ lpfc_mem_free(struct lpfc_hba *phba)
>  
>  	/* Free MBUF memory pool */
>  	for (i = 0; i < pool->current_count; i++)
> -		pci_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
> +		dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
>  			      pool->elements[i].phys);
>  	kfree(pool->elements);
>  
> -	pci_pool_destroy(phba->lpfc_mbuf_pool);
> +	dma_pool_destroy(phba->lpfc_mbuf_pool);
>  	phba->lpfc_mbuf_pool = NULL;
>  
>  	/* Free DMA buffer memory pool */
> -	pci_pool_destroy(phba->lpfc_sg_dma_buf_pool);
> +	dma_pool_destroy(phba->lpfc_sg_dma_buf_pool);
>  	phba->lpfc_sg_dma_buf_pool = NULL;
>  
>  	/* Free Device Data memory pool */
> @@ -361,7 +358,7 @@ lpfc_mem_free_all(struct lpfc_hba *phba)
>   * @handle: used to return the DMA-mapped address of the mbuf
>   *
>   * Description: Allocates a DMA-mapped buffer from the lpfc_mbuf_pool PCI pool.
> - * Allocates from generic pci_pool_alloc function first and if that fails and
> + * Allocates from generic dma_pool_alloc function first and if that fails and
>   * mem_flags has MEM_PRI set (the only defined flag), returns an mbuf from the
>   * HBA's pool.
>   *
> @@ -379,7 +376,7 @@ lpfc_mbuf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle)
>  	unsigned long iflags;
>  	void *ret;
>  
> -	ret = pci_pool_alloc(phba->lpfc_mbuf_pool, GFP_KERNEL, handle);
> +	ret = dma_pool_alloc(phba->lpfc_mbuf_pool, GFP_KERNEL, handle);
>  
>  	spin_lock_irqsave(&phba->hbalock, iflags);
>  	if (!ret && (mem_flags & MEM_PRI) && pool->current_count) {
> @@ -415,7 +412,7 @@ __lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
>  		pool->elements[pool->current_count].phys = dma;
>  		pool->current_count++;
>  	} else {
> -		pci_pool_free(phba->lpfc_mbuf_pool, virt, dma);
> +		dma_pool_free(phba->lpfc_mbuf_pool, virt, dma);
>  	}
>  	return;
>  }
> @@ -452,7 +449,7 @@ lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
>   * @handle: used to return the DMA-mapped address of the nvmet_buf
>   *
>   * Description: Allocates a DMA-mapped buffer from the lpfc_sg_dma_buf_pool
> - * PCI pool.  Allocates from generic pci_pool_alloc function.
> + * PCI pool.  Allocates from generic dma_pool_alloc function.
>   *
>   * Returns:
>   *   pointer to the allocated nvmet_buf on success
> @@ -463,7 +460,7 @@ lpfc_nvmet_buf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle)
>  {
>  	void *ret;
>  
> -	ret = pci_pool_alloc(phba->lpfc_sg_dma_buf_pool, GFP_KERNEL, handle);
> +	ret = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool, GFP_KERNEL, handle);
>  	return ret;
>  }
>  
> @@ -479,7 +476,7 @@ lpfc_nvmet_buf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle)
>  void
>  lpfc_nvmet_buf_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma)
>  {
> -	pci_pool_free(phba->lpfc_sg_dma_buf_pool, virt, dma);
> +	dma_pool_free(phba->lpfc_sg_dma_buf_pool, virt, dma);
>  }
>  
>  /**
> @@ -504,7 +501,7 @@ lpfc_els_hbq_alloc(struct lpfc_hba *phba)
>  	if (!hbqbp)
>  		return NULL;
>  
> -	hbqbp->dbuf.virt = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL,
> +	hbqbp->dbuf.virt = dma_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL,
>  					  &hbqbp->dbuf.phys);
>  	if (!hbqbp->dbuf.virt) {
>  		kfree(hbqbp);
> @@ -529,7 +526,7 @@ lpfc_els_hbq_alloc(struct lpfc_hba *phba)
>  void
>  lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp)
>  {
> -	pci_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys);
> +	dma_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys);
>  	kfree(hbqbp);
>  	return;
>  }
> @@ -556,16 +553,16 @@ lpfc_sli4_rb_alloc(struct lpfc_hba *phba)
>  	if (!dma_buf)
>  		return NULL;
>  
> -	dma_buf->hbuf.virt = pci_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
> +	dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
>  					    &dma_buf->hbuf.phys);
>  	if (!dma_buf->hbuf.virt) {
>  		kfree(dma_buf);
>  		return NULL;
>  	}
> -	dma_buf->dbuf.virt = pci_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
> +	dma_buf->dbuf.virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
>  					    &dma_buf->dbuf.phys);
>  	if (!dma_buf->dbuf.virt) {
> -		pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
> +		dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
>  			      dma_buf->hbuf.phys);
>  		kfree(dma_buf);
>  		return NULL;
> @@ -589,8 +586,8 @@ lpfc_sli4_rb_alloc(struct lpfc_hba *phba)
>  void
>  lpfc_sli4_rb_free(struct lpfc_hba *phba, struct hbq_dmabuf *dmab)
>  {
> -	pci_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
> -	pci_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys);
> +	dma_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
> +	dma_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys);
>  	kfree(dmab);
>  }
>  
> @@ -618,16 +615,16 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
>  	if (!dma_buf)
>  		return NULL;
>  
> -	dma_buf->hbuf.virt = pci_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
> +	dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
>  					    &dma_buf->hbuf.phys);
>  	if (!dma_buf->hbuf.virt) {
>  		kfree(dma_buf);
>  		return NULL;
>  	}
> -	dma_buf->dbuf.virt = pci_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
> +	dma_buf->dbuf.virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
>  					    &dma_buf->dbuf.phys);
>  	if (!dma_buf->dbuf.virt) {
> -		pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
> +		dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
>  			      dma_buf->hbuf.phys);
>  		kfree(dma_buf);
>  		return NULL;
> @@ -637,9 +634,9 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
>  	dma_buf->context = kzalloc(sizeof(struct lpfc_nvmet_rcv_ctx),
>  				   GFP_KERNEL);
>  	if (!dma_buf->context) {
> -		pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
> +		dma_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
>  			      dma_buf->dbuf.phys);
> -		pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
> +		dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
>  			      dma_buf->hbuf.phys);
>  		kfree(dma_buf);
>  		return NULL;
> @@ -649,9 +646,9 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
>  	dma_buf->iocbq->iocb_flag = LPFC_IO_NVMET;
>  	if (!dma_buf->iocbq) {
>  		kfree(dma_buf->context);
> -		pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
> +		dma_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
>  			      dma_buf->dbuf.phys);
> -		pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
> +		dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
>  			      dma_buf->hbuf.phys);
>  		kfree(dma_buf);
>  		lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
> @@ -678,9 +675,9 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
>  	if (!dma_buf->sglq) {
>  		lpfc_sli_release_iocbq(phba, dma_buf->iocbq);
>  		kfree(dma_buf->context);
> -		pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
> +		dma_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
>  			      dma_buf->dbuf.phys);
> -		pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
> +		dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
>  			      dma_buf->hbuf.phys);
>  		kfree(dma_buf);
>  		lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
> @@ -717,8 +714,8 @@ lpfc_sli4_nvmet_free(struct lpfc_hba *phba, struct rqb_dmabuf *dmab)
>  
>  	lpfc_sli_release_iocbq(phba, dmab->iocbq);
>  	kfree(dmab->context);
> -	pci_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
> -	pci_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys);
> +	dma_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
> +	dma_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys);
>  	kfree(dmab);
>  }
>  
> diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
> index 625b658..0b38a5e 100644
> --- a/drivers/scsi/lpfc/lpfc_nvme.c
> +++ b/drivers/scsi/lpfc/lpfc_nvme.c
> @@ -1950,7 +1950,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc)
>  		 * pci bus space for an I/O. The DMA buffer includes the
>  		 * number of SGE's necessary to support the sg_tablesize.
>  		 */
> -		lpfc_ncmd->data = pci_pool_alloc(phba->lpfc_sg_dma_buf_pool,
> +		lpfc_ncmd->data = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool,
>  						 GFP_KERNEL,
>  						 &lpfc_ncmd->dma_handle);
>  		if (!lpfc_ncmd->data) {
> @@ -1961,7 +1961,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc)
>  
>  		lxri = lpfc_sli4_next_xritag(phba);
>  		if (lxri == NO_XRI) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      lpfc_ncmd->data, lpfc_ncmd->dma_handle);
>  			kfree(lpfc_ncmd);
>  			break;
> @@ -1972,7 +1972,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc)
>  		/* Allocate iotag for lpfc_ncmd->cur_iocbq. */
>  		iotag = lpfc_sli_next_iotag(phba, pwqeq);
>  		if (iotag == 0) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      lpfc_ncmd->data, lpfc_ncmd->dma_handle);
>  			kfree(lpfc_ncmd);
>  			lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
> diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
> index c421e17..a446c52 100644
> --- a/drivers/scsi/lpfc/lpfc_nvmet.c
> +++ b/drivers/scsi/lpfc/lpfc_nvmet.c
> @@ -140,7 +140,7 @@ lpfc_nvmet_rq_post(struct lpfc_hba *phba, struct lpfc_nvmet_rcv_ctx *ctxp,
>  {
>  	if (ctxp) {
>  		if (ctxp->txrdy) {
> -			pci_pool_free(phba->txrdy_payload_pool, ctxp->txrdy,
> +			dma_pool_free(phba->txrdy_payload_pool, ctxp->txrdy,
>  				      ctxp->txrdy_phys);
>  			ctxp->txrdy = NULL;
>  			ctxp->txrdy_phys = 0;
> @@ -1353,7 +1353,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
>  
>  	case NVMET_FCOP_WRITEDATA:
>  		/* Words 0 - 2 : The first sg segment */
> -		txrdy = pci_pool_alloc(phba->txrdy_payload_pool,
> +		txrdy = dma_pool_alloc(phba->txrdy_payload_pool,
>  				       GFP_KERNEL, &physaddr);
>  		if (!txrdy) {
>  			lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
> diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
> index 9d6384a..b3a4238 100644
> --- a/drivers/scsi/lpfc/lpfc_scsi.c
> +++ b/drivers/scsi/lpfc/lpfc_scsi.c
> @@ -415,7 +415,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_to_alloc)
>  		 * struct fcp_cmnd, struct fcp_rsp and the number of bde's
>  		 * necessary to support the sg_tablesize.
>  		 */
> -		psb->data = pci_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
> +		psb->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
>  					GFP_KERNEL, &psb->dma_handle);
>  		if (!psb->data) {
>  			kfree(psb);
> @@ -426,7 +426,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_to_alloc)
>  		/* Allocate iotag for psb->cur_iocbq. */
>  		iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq);
>  		if (iotag == 0) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      psb->data, psb->dma_handle);
>  			kfree(psb);
>  			break;
> @@ -825,7 +825,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
>  		 * for the struct fcp_cmnd, struct fcp_rsp and the number
>  		 * of bde's necessary to support the sg_tablesize.
>  		 */
> -		psb->data = pci_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
> +		psb->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
>  						GFP_KERNEL, &psb->dma_handle);
>  		if (!psb->data) {
>  			kfree(psb);
> @@ -838,7 +838,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
>  		 */
>  		if (phba->cfg_enable_bg  && (((unsigned long)(psb->data) &
>  		    (unsigned long)(SLI4_PAGE_SIZE - 1)) != 0)) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      psb->data, psb->dma_handle);
>  			kfree(psb);
>  			break;
> @@ -847,7 +847,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
>  
>  		lxri = lpfc_sli4_next_xritag(phba);
>  		if (lxri == NO_XRI) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      psb->data, psb->dma_handle);
>  			kfree(psb);
>  			break;
> @@ -856,7 +856,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
>  		/* Allocate iotag for psb->cur_iocbq. */
>  		iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq);
>  		if (iotag == 0) {
> -			pci_pool_free(phba->lpfc_sg_dma_buf_pool,
> +			dma_pool_free(phba->lpfc_sg_dma_buf_pool,
>  				      psb->data, psb->dma_handle);
>  			kfree(psb);
>  			lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 11/20] scsi: megaraid: Replace PCI pool old API
       [not found] ` <20170226192425.13098-12-romain.perier@collabora.com>
@ 2017-02-27 11:16   ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:16 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:16PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  drivers/scsi/megaraid/megaraid_mbox.c       | 33 +++++++--------
>  drivers/scsi/megaraid/megaraid_mm.c         | 32 +++++++-------
>  drivers/scsi/megaraid/megaraid_sas_base.c   | 29 +++++++------
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 66 +++++++++++++----------------
>  4 files changed, 77 insertions(+), 83 deletions(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
> index f0987f2..7dfc2e2 100644
> --- a/drivers/scsi/megaraid/megaraid_mbox.c
> +++ b/drivers/scsi/megaraid/megaraid_mbox.c
> @@ -1153,8 +1153,8 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
>  
>  
>  	// Allocate memory for 16-bytes aligned mailboxes
> -	raid_dev->mbox_pool_handle = pci_pool_create("megaraid mbox pool",
> -						adapter->pdev,
> +	raid_dev->mbox_pool_handle = dma_pool_create("megaraid mbox pool",
> +						&adapter->pdev->dev,
>  						sizeof(mbox64_t) + 16,
>  						16, 0);
>  
> @@ -1164,7 +1164,7 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
>  
>  	mbox_pci_blk = raid_dev->mbox_pool;
>  	for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) {
> -		mbox_pci_blk[i].vaddr = pci_pool_alloc(
> +		mbox_pci_blk[i].vaddr = dma_pool_alloc(
>  						raid_dev->mbox_pool_handle,
>  						GFP_KERNEL,
>  						&mbox_pci_blk[i].dma_addr);
> @@ -1181,8 +1181,8 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
>  	 * share common memory pool. Passthru structures piggyback on memory
>  	 * allocted to extended passthru since passthru is smaller of the two
>  	 */
> -	raid_dev->epthru_pool_handle = pci_pool_create("megaraid mbox pthru",
> -			adapter->pdev, sizeof(mraid_epassthru_t), 128, 0);
> +	raid_dev->epthru_pool_handle = dma_pool_create("megaraid mbox pthru",
> +			&adapter->pdev->dev, sizeof(mraid_epassthru_t), 128, 0);
>  
>  	if (raid_dev->epthru_pool_handle == NULL) {
>  		goto fail_setup_dma_pool;
> @@ -1190,7 +1190,7 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
>  
>  	epthru_pci_blk = raid_dev->epthru_pool;
>  	for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) {
> -		epthru_pci_blk[i].vaddr = pci_pool_alloc(
> +		epthru_pci_blk[i].vaddr = dma_pool_alloc(
>  						raid_dev->epthru_pool_handle,
>  						GFP_KERNEL,
>  						&epthru_pci_blk[i].dma_addr);
> @@ -1202,8 +1202,8 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
>  
>  	// Allocate memory for each scatter-gather list. Request for 512 bytes
>  	// alignment for each sg list
> -	raid_dev->sg_pool_handle = pci_pool_create("megaraid mbox sg",
> -					adapter->pdev,
> +	raid_dev->sg_pool_handle = dma_pool_create("megaraid mbox sg",
> +					&adapter->pdev->dev,
>  					sizeof(mbox_sgl64) * MBOX_MAX_SG_SIZE,
>  					512, 0);
>  
> @@ -1213,7 +1213,7 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
>  
>  	sg_pci_blk = raid_dev->sg_pool;
>  	for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) {
> -		sg_pci_blk[i].vaddr = pci_pool_alloc(
> +		sg_pci_blk[i].vaddr = dma_pool_alloc(
>  						raid_dev->sg_pool_handle,
>  						GFP_KERNEL,
>  						&sg_pci_blk[i].dma_addr);
> @@ -1249,29 +1249,26 @@ megaraid_mbox_teardown_dma_pools(adapter_t *adapter)
>  
>  	sg_pci_blk = raid_dev->sg_pool;
>  	for (i = 0; i < MBOX_MAX_SCSI_CMDS && sg_pci_blk[i].vaddr; i++) {
> -		pci_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr,
> +		dma_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr,
>  			sg_pci_blk[i].dma_addr);
>  	}
> -	if (raid_dev->sg_pool_handle)
> -		pci_pool_destroy(raid_dev->sg_pool_handle);
> +	dma_pool_destroy(raid_dev->sg_pool_handle);
>  
>  
>  	epthru_pci_blk = raid_dev->epthru_pool;
>  	for (i = 0; i < MBOX_MAX_SCSI_CMDS && epthru_pci_blk[i].vaddr; i++) {
> -		pci_pool_free(raid_dev->epthru_pool_handle,
> +		dma_pool_free(raid_dev->epthru_pool_handle,
>  			epthru_pci_blk[i].vaddr, epthru_pci_blk[i].dma_addr);
>  	}
> -	if (raid_dev->epthru_pool_handle)
> -		pci_pool_destroy(raid_dev->epthru_pool_handle);
> +	dma_pool_destroy(raid_dev->epthru_pool_handle);
>  
>  
>  	mbox_pci_blk = raid_dev->mbox_pool;
>  	for (i = 0; i < MBOX_MAX_SCSI_CMDS && mbox_pci_blk[i].vaddr; i++) {
> -		pci_pool_free(raid_dev->mbox_pool_handle,
> +		dma_pool_free(raid_dev->mbox_pool_handle,
>  			mbox_pci_blk[i].vaddr, mbox_pci_blk[i].dma_addr);
>  	}
> -	if (raid_dev->mbox_pool_handle)
> -		pci_pool_destroy(raid_dev->mbox_pool_handle);
> +	dma_pool_destroy(raid_dev->mbox_pool_handle);
>  
>  	return;
>  }
> diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
> index 4cf9ed9..2324dd8 100644
> --- a/drivers/scsi/megaraid/megaraid_mm.c
> +++ b/drivers/scsi/megaraid/megaraid_mm.c
> @@ -574,7 +574,7 @@ mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen)
>  
>  	kioc->pool_index	= right_pool;
>  	kioc->free_buf		= 1;
> -	kioc->buf_vaddr 	= pci_pool_alloc(pool->handle, GFP_KERNEL,
> +	kioc->buf_vaddr		= dma_pool_alloc(pool->handle, GFP_KERNEL,
>  							&kioc->buf_paddr);
>  	spin_unlock_irqrestore(&pool->lock, flags);
>  
> @@ -658,7 +658,7 @@ mraid_mm_dealloc_kioc(mraid_mmadp_t *adp, uioc_t *kioc)
>  		 * not in use
>  		 */
>  		if (kioc->free_buf == 1)
> -			pci_pool_free(pool->handle, kioc->buf_vaddr, 
> +			dma_pool_free(pool->handle, kioc->buf_vaddr,
>  							kioc->buf_paddr);
>  		else
>  			pool->in_use = 0;
> @@ -940,8 +940,8 @@ mraid_mm_register_adp(mraid_mmadp_t *lld_adp)
>  						GFP_KERNEL);
>  	adapter->mbox_list	= kmalloc(sizeof(mbox64_t) * lld_adp->max_kioc,
>  						GFP_KERNEL);
> -	adapter->pthru_dma_pool = pci_pool_create("megaraid mm pthru pool",
> -						adapter->pdev,
> +	adapter->pthru_dma_pool = dma_pool_create("megaraid mm pthru pool",
> +						&adapter->pdev->dev,
>  						sizeof(mraid_passthru_t),
>  						16, 0);
>  
> @@ -970,7 +970,7 @@ mraid_mm_register_adp(mraid_mmadp_t *lld_adp)
>  
>  		kioc		= adapter->kioc_list + i;
>  		kioc->cmdbuf	= (uint64_t)(unsigned long)(mbox_list + i);
> -		kioc->pthru32	= pci_pool_alloc(adapter->pthru_dma_pool,
> +		kioc->pthru32	= dma_pool_alloc(adapter->pthru_dma_pool,
>  						GFP_KERNEL, &kioc->pthru32_h);
>  
>  		if (!kioc->pthru32) {
> @@ -1006,7 +1006,7 @@ mraid_mm_register_adp(mraid_mmadp_t *lld_adp)
>  	for (i = 0; i < lld_adp->max_kioc; i++) {
>  		kioc = adapter->kioc_list + i;
>  		if (kioc->pthru32) {
> -			pci_pool_free(adapter->pthru_dma_pool, kioc->pthru32,
> +			dma_pool_free(adapter->pthru_dma_pool, kioc->pthru32,
>  				kioc->pthru32_h);
>  		}
>  	}
> @@ -1016,8 +1016,7 @@ mraid_mm_register_adp(mraid_mmadp_t *lld_adp)
>  	kfree(adapter->kioc_list);
>  	kfree(adapter->mbox_list);
>  
> -	if (adapter->pthru_dma_pool)
> -		pci_pool_destroy(adapter->pthru_dma_pool);
> +	dma_pool_destroy(adapter->pthru_dma_pool);
>  
>  	kfree(adapter);
>  
> @@ -1086,15 +1085,16 @@ mraid_mm_setup_dma_pools(mraid_mmadp_t *adp)
>  		pool->buf_size = bufsize;
>  		spin_lock_init(&pool->lock);
>  
> -		pool->handle = pci_pool_create("megaraid mm data buffer",
> -						adp->pdev, bufsize, 16, 0);
> +		pool->handle = dma_pool_create("megaraid mm data buffer",
> +					       &adp->pdev->dev, bufsize, 16,
> +					       0);
>  
>  		if (!pool->handle) {
>  			goto dma_pool_setup_error;
>  		}
>  
> -		pool->vaddr = pci_pool_alloc(pool->handle, GFP_KERNEL,
> -							&pool->paddr);
> +		pool->vaddr = dma_pool_alloc(pool->handle, GFP_KERNEL,
> +					     &pool->paddr);
>  
>  		if (!pool->vaddr)
>  			goto dma_pool_setup_error;
> @@ -1163,14 +1163,14 @@ mraid_mm_free_adp_resources(mraid_mmadp_t *adp)
>  
>  		kioc = adp->kioc_list + i;
>  
> -		pci_pool_free(adp->pthru_dma_pool, kioc->pthru32,
> +		dma_pool_free(adp->pthru_dma_pool, kioc->pthru32,
>  				kioc->pthru32_h);
>  	}
>  
>  	kfree(adp->kioc_list);
>  	kfree(adp->mbox_list);
>  
> -	pci_pool_destroy(adp->pthru_dma_pool);
> +	dma_pool_destroy(adp->pthru_dma_pool);
>  
>  
>  	return;
> @@ -1194,10 +1194,10 @@ mraid_mm_teardown_dma_pools(mraid_mmadp_t *adp)
>  		if (pool->handle) {
>  
>  			if (pool->vaddr)
> -				pci_pool_free(pool->handle, pool->vaddr,
> +				dma_pool_free(pool->handle, pool->vaddr,
>  							pool->paddr);
>  
> -			pci_pool_destroy(pool->handle);
> +			dma_pool_destroy(pool->handle);
>  			pool->handle = NULL;
>  		}
>  	}
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 7ac9a9e..bd32bfc 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -3859,19 +3859,19 @@ static void megasas_teardown_frame_pool(struct megasas_instance *instance)
>  		cmd = instance->cmd_list[i];
>  
>  		if (cmd->frame)
> -			pci_pool_free(instance->frame_dma_pool, cmd->frame,
> +			dma_pool_free(instance->frame_dma_pool, cmd->frame,
>  				      cmd->frame_phys_addr);
>  
>  		if (cmd->sense)
> -			pci_pool_free(instance->sense_dma_pool, cmd->sense,
> +			dma_pool_free(instance->sense_dma_pool, cmd->sense,
>  				      cmd->sense_phys_addr);
>  	}
>  
>  	/*
>  	 * Now destroy the pool itself
>  	 */
> -	pci_pool_destroy(instance->frame_dma_pool);
> -	pci_pool_destroy(instance->sense_dma_pool);
> +	dma_pool_destroy(instance->frame_dma_pool);
> +	dma_pool_destroy(instance->sense_dma_pool);
>  
>  	instance->frame_dma_pool = NULL;
>  	instance->sense_dma_pool = NULL;
> @@ -3922,22 +3922,24 @@ static int megasas_create_frame_pool(struct megasas_instance *instance)
>  	/*
>  	 * Use DMA pool facility provided by PCI layer
>  	 */
> -	instance->frame_dma_pool = pci_pool_create("megasas frame pool",
> -					instance->pdev, instance->mfi_frame_size,
> -					256, 0);
> +	instance->frame_dma_pool = dma_pool_create("megasas frame pool",
> +						   &instance->pdev->dev,
> +						   instance->mfi_frame_size,
> +						   256, 0);
>  
>  	if (!instance->frame_dma_pool) {
>  		dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to setup frame pool\n");
>  		return -ENOMEM;
>  	}
>  
> -	instance->sense_dma_pool = pci_pool_create("megasas sense pool",
> -						   instance->pdev, 128, 4, 0);
> +	instance->sense_dma_pool = dma_pool_create("megasas sense pool",
> +						   &instance->pdev->dev, 128,
> +						   4, 0);
>  
>  	if (!instance->sense_dma_pool) {
>  		dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to setup sense pool\n");
>  
> -		pci_pool_destroy(instance->frame_dma_pool);
> +		dma_pool_destroy(instance->frame_dma_pool);
>  		instance->frame_dma_pool = NULL;
>  
>  		return -ENOMEM;
> @@ -3952,10 +3954,10 @@ static int megasas_create_frame_pool(struct megasas_instance *instance)
>  
>  		cmd = instance->cmd_list[i];
>  
> -		cmd->frame = pci_pool_alloc(instance->frame_dma_pool,
> +		cmd->frame = dma_pool_alloc(instance->frame_dma_pool,
>  					    GFP_KERNEL, &cmd->frame_phys_addr);
>  
> -		cmd->sense = pci_pool_alloc(instance->sense_dma_pool,
> +		cmd->sense = dma_pool_alloc(instance->sense_dma_pool,
>  					    GFP_KERNEL, &cmd->sense_phys_addr);
>  
>  		/*
> @@ -3963,7 +3965,8 @@ static int megasas_create_frame_pool(struct megasas_instance *instance)
>  		 * whatever has been allocated
>  		 */
>  		if (!cmd->frame || !cmd->sense) {
> -			dev_printk(KERN_DEBUG, &instance->pdev->dev, "pci_pool_alloc failed\n");
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev,
> +				   "dma_pool_alloc failed\n");
>  			megasas_teardown_frame_pool(instance);
>  			return -ENOMEM;
>  		}
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index 29650ba..a5529f7 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -313,22 +313,19 @@ megasas_free_cmds_fusion(struct megasas_instance *instance)
>  		cmd = fusion->cmd_list[i];
>  		if (cmd) {
>  			if (cmd->sg_frame)
> -				pci_pool_free(fusion->sg_dma_pool, cmd->sg_frame,
> -				      cmd->sg_frame_phys_addr);
> +				dma_pool_free(fusion->sg_dma_pool,
> +					      cmd->sg_frame,
> +					      cmd->sg_frame_phys_addr);
>  			if (cmd->sense)
> -				pci_pool_free(fusion->sense_dma_pool, cmd->sense,
> -				      cmd->sense_phys_addr);
> +				dma_pool_free(fusion->sense_dma_pool,
> +					      cmd->sense, cmd->sense_phys_addr);
>  		}
>  	}
>  
> -	if (fusion->sg_dma_pool) {
> -		pci_pool_destroy(fusion->sg_dma_pool);
> -		fusion->sg_dma_pool = NULL;
> -	}
> -	if (fusion->sense_dma_pool) {
> -		pci_pool_destroy(fusion->sense_dma_pool);
> -		fusion->sense_dma_pool = NULL;
> -	}
> +	dma_pool_destroy(fusion->sg_dma_pool);
> +	fusion->sg_dma_pool = NULL;
> +	dma_pool_destroy(fusion->sense_dma_pool);
> +	fusion->sense_dma_pool = NULL;
>  
>  
>  	/* Reply Frame, Desc*/
> @@ -343,14 +340,11 @@ megasas_free_cmds_fusion(struct megasas_instance *instance)
>  			fusion->request_alloc_sz, fusion->req_frames_desc,
>  			fusion->req_frames_desc_phys);
>  	if (fusion->io_request_frames)
> -		pci_pool_free(fusion->io_request_frames_pool,
> +		dma_pool_free(fusion->io_request_frames_pool,
>  			fusion->io_request_frames,
>  			fusion->io_request_frames_phys);
> -	if (fusion->io_request_frames_pool) {
> -		pci_pool_destroy(fusion->io_request_frames_pool);
> -		fusion->io_request_frames_pool = NULL;
> -	}
> -
> +	dma_pool_destroy(fusion->io_request_frames_pool);
> +	fusion->io_request_frames_pool = NULL;
>  
>  	/* cmd_list */
>  	for (i = 0; i < instance->max_mpt_cmds; i++)
> @@ -376,12 +370,12 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
>  
>  
>  	fusion->sg_dma_pool =
> -			pci_pool_create("mr_sg", instance->pdev,
> +			dma_pool_create("mr_sg", &instance->pdev->dev,
>  				instance->max_chain_frame_sz,
>  				MR_DEFAULT_NVME_PAGE_SIZE, 0);
>  	/* SCSI_SENSE_BUFFERSIZE  = 96 bytes */
>  	fusion->sense_dma_pool =
> -			pci_pool_create("mr_sense", instance->pdev,
> +			dma_pool_create("mr_sense", &instance->pdev->dev,
>  				SCSI_SENSE_BUFFERSIZE, 64, 0);
>  
>  	if (!fusion->sense_dma_pool || !fusion->sg_dma_pool) {
> @@ -395,10 +389,10 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
>  	 */
>  	for (i = 0; i < max_cmd; i++) {
>  		cmd = fusion->cmd_list[i];
> -		cmd->sg_frame = pci_pool_alloc(fusion->sg_dma_pool,
> +		cmd->sg_frame = dma_pool_alloc(fusion->sg_dma_pool,
>  					GFP_KERNEL, &cmd->sg_frame_phys_addr);
>  
> -		cmd->sense = pci_pool_alloc(fusion->sense_dma_pool,
> +		cmd->sense = dma_pool_alloc(fusion->sense_dma_pool,
>  					GFP_KERNEL, &cmd->sense_phys_addr);
>  		if (!cmd->sg_frame || !cmd->sense) {
>  			dev_err(&instance->pdev->dev,
> @@ -410,7 +404,7 @@ static int megasas_create_sg_sense_fusion(struct megasas_instance *instance)
>  	/* create sense buffer for the raid 1/10 fp */
>  	for (i = max_cmd; i < instance->max_mpt_cmds; i++) {
>  		cmd = fusion->cmd_list[i];
> -		cmd->sense = pci_pool_alloc(fusion->sense_dma_pool,
> +		cmd->sense = dma_pool_alloc(fusion->sense_dma_pool,
>  			GFP_KERNEL, &cmd->sense_phys_addr);
>  		if (!cmd->sense) {
>  			dev_err(&instance->pdev->dev,
> @@ -475,7 +469,7 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
>  	}
>  
>  	fusion->io_request_frames_pool =
> -			pci_pool_create("mr_ioreq", instance->pdev,
> +			dma_pool_create("mr_ioreq", &instance->pdev->dev,
>  				fusion->io_frames_alloc_sz, 16, 0);
>  
>  	if (!fusion->io_request_frames_pool) {
> @@ -485,7 +479,7 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
>  	}
>  
>  	fusion->io_request_frames =
> -			pci_pool_alloc(fusion->io_request_frames_pool,
> +			dma_pool_alloc(fusion->io_request_frames_pool,
>  				GFP_KERNEL, &fusion->io_request_frames_phys);
>  	if (!fusion->io_request_frames) {
>  		dev_err(&instance->pdev->dev,
> @@ -505,7 +499,7 @@ megasas_alloc_reply_fusion(struct megasas_instance *instance)
>  
>  	count = instance->msix_vectors > 0 ? instance->msix_vectors : 1;
>  	fusion->reply_frames_desc_pool =
> -			pci_pool_create("mr_reply", instance->pdev,
> +			dma_pool_create("mr_reply", &instance->pdev->dev,
>  				fusion->reply_alloc_sz * count, 16, 0);
>  
>  	if (!fusion->reply_frames_desc_pool) {
> @@ -515,7 +509,7 @@ megasas_alloc_reply_fusion(struct megasas_instance *instance)
>  	}
>  
>  	fusion->reply_frames_desc[0] =
> -		pci_pool_alloc(fusion->reply_frames_desc_pool,
> +		dma_pool_alloc(fusion->reply_frames_desc_pool,
>  			GFP_KERNEL, &fusion->reply_frames_desc_phys[0]);
>  	if (!fusion->reply_frames_desc[0]) {
>  		dev_err(&instance->pdev->dev,
> @@ -558,8 +552,10 @@ megasas_alloc_rdpq_fusion(struct megasas_instance *instance)
>  	memset(fusion->rdpq_virt, 0,
>  			sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) * MAX_MSIX_QUEUES_FUSION);
>  	count = instance->msix_vectors > 0 ? instance->msix_vectors : 1;
> -	fusion->reply_frames_desc_pool = pci_pool_create("mr_rdpq",
> -							 instance->pdev, fusion->reply_alloc_sz, 16, 0);
> +	fusion->reply_frames_desc_pool = dma_pool_create("mr_rdpq",
> +							 &instance->pdev->dev,
> +							 fusion->reply_alloc_sz,
> +							 16, 0);
>  
>  	if (!fusion->reply_frames_desc_pool) {
>  		dev_err(&instance->pdev->dev,
> @@ -569,7 +565,7 @@ megasas_alloc_rdpq_fusion(struct megasas_instance *instance)
>  
>  	for (i = 0; i < count; i++) {
>  		fusion->reply_frames_desc[i] =
> -				pci_pool_alloc(fusion->reply_frames_desc_pool,
> +				dma_pool_alloc(fusion->reply_frames_desc_pool,
>  					GFP_KERNEL, &fusion->reply_frames_desc_phys[i]);
>  		if (!fusion->reply_frames_desc[i]) {
>  			dev_err(&instance->pdev->dev,
> @@ -597,13 +593,12 @@ megasas_free_rdpq_fusion(struct megasas_instance *instance) {
>  
>  	for (i = 0; i < MAX_MSIX_QUEUES_FUSION; i++) {
>  		if (fusion->reply_frames_desc[i])
> -			pci_pool_free(fusion->reply_frames_desc_pool,
> +			dma_pool_free(fusion->reply_frames_desc_pool,
>  				fusion->reply_frames_desc[i],
>  				fusion->reply_frames_desc_phys[i]);
>  	}
>  
> -	if (fusion->reply_frames_desc_pool)
> -		pci_pool_destroy(fusion->reply_frames_desc_pool);
> +	dma_pool_destroy(fusion->reply_frames_desc_pool);
>  
>  	if (fusion->rdpq_virt)
>  		pci_free_consistent(instance->pdev,
> @@ -619,12 +614,11 @@ megasas_free_reply_fusion(struct megasas_instance *instance) {
>  	fusion = instance->ctrl_context;
>  
>  	if (fusion->reply_frames_desc[0])
> -		pci_pool_free(fusion->reply_frames_desc_pool,
> +		dma_pool_free(fusion->reply_frames_desc_pool,
>  			fusion->reply_frames_desc[0],
>  			fusion->reply_frames_desc_phys[0]);
>  
> -	if (fusion->reply_frames_desc_pool)
> -		pci_pool_destroy(fusion->reply_frames_desc_pool);
> +	dma_pool_destroy(fusion->reply_frames_desc_pool);
>  
>  }
>  
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 12/20] scsi: mpt3sas: Replace PCI pool old API
       [not found] ` <20170226192425.13098-13-romain.perier@collabora.com>
@ 2017-02-27 11:18       ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:18 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w, David S. Miller,
	stas.yakovlev-Re5JQEeQqe8AvxtiuMwx3w, James E.J. Bottomley,
	Martin K. Petersen, Felipe Balbi, Greg Kroah-Hartman,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:17PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> Signed-off-by: Romain Perier <romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> ---
>  drivers/scsi/mpt3sas/mpt3sas_base.c | 73 +++++++++++++++++--------------------
>  1 file changed, 34 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index 5b7aec5..5ae1c23 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -3200,9 +3200,8 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  	}
>  
>  	if (ioc->sense) {
> -		pci_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
> -		if (ioc->sense_dma_pool)
> -			pci_pool_destroy(ioc->sense_dma_pool);
> +		dma_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
> +		dma_pool_destroy(ioc->sense_dma_pool);
>  		dexitprintk(ioc, pr_info(MPT3SAS_FMT
>  			"sense_pool(0x%p): free\n",
>  			ioc->name, ioc->sense));
> @@ -3210,9 +3209,8 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  	}
>  
>  	if (ioc->reply) {
> -		pci_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
> -		if (ioc->reply_dma_pool)
> -			pci_pool_destroy(ioc->reply_dma_pool);
> +		dma_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
> +		dma_pool_destroy(ioc->reply_dma_pool);
>  		dexitprintk(ioc, pr_info(MPT3SAS_FMT
>  			"reply_pool(0x%p): free\n",
>  			ioc->name, ioc->reply));
> @@ -3220,10 +3218,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  	}
>  
>  	if (ioc->reply_free) {
> -		pci_pool_free(ioc->reply_free_dma_pool, ioc->reply_free,
> +		dma_pool_free(ioc->reply_free_dma_pool, ioc->reply_free,
>  		    ioc->reply_free_dma);
> -		if (ioc->reply_free_dma_pool)
> -			pci_pool_destroy(ioc->reply_free_dma_pool);
> +		dma_pool_destroy(ioc->reply_free_dma_pool);
>  		dexitprintk(ioc, pr_info(MPT3SAS_FMT
>  			"reply_free_pool(0x%p): free\n",
>  			ioc->name, ioc->reply_free));
> @@ -3234,7 +3231,7 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  		do {
>  			rps = &ioc->reply_post[i];
>  			if (rps->reply_post_free) {
> -				pci_pool_free(
> +				dma_pool_free(
>  				    ioc->reply_post_free_dma_pool,
>  				    rps->reply_post_free,
>  				    rps->reply_post_free_dma);
> @@ -3246,8 +3243,7 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  		} while (ioc->rdpq_array_enable &&
>  			   (++i < ioc->reply_queue_count));
>  
> -		if (ioc->reply_post_free_dma_pool)
> -			pci_pool_destroy(ioc->reply_post_free_dma_pool);
> +		dma_pool_destroy(ioc->reply_post_free_dma_pool);
>  		kfree(ioc->reply_post);
>  	}
>  
> @@ -3268,12 +3264,11 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  	if (ioc->chain_lookup) {
>  		for (i = 0; i < ioc->chain_depth; i++) {
>  			if (ioc->chain_lookup[i].chain_buffer)
> -				pci_pool_free(ioc->chain_dma_pool,
> +				dma_pool_free(ioc->chain_dma_pool,
>  				    ioc->chain_lookup[i].chain_buffer,
>  				    ioc->chain_lookup[i].chain_buffer_dma);
>  		}
> -		if (ioc->chain_dma_pool)
> -			pci_pool_destroy(ioc->chain_dma_pool);
> +		dma_pool_destroy(ioc->chain_dma_pool);
>  		free_pages((ulong)ioc->chain_lookup, ioc->chain_pages);
>  		ioc->chain_lookup = NULL;
>  	}
> @@ -3448,23 +3443,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  			ioc->name);
>  		goto out;
>  	}
> -	ioc->reply_post_free_dma_pool = pci_pool_create("reply_post_free pool",
> -	    ioc->pdev, sz, 16, 0);
> +	ioc->reply_post_free_dma_pool = dma_pool_create("reply_post_free pool",
> +	    &ioc->pdev->dev, sz, 16, 0);
>  	if (!ioc->reply_post_free_dma_pool) {
>  		pr_err(MPT3SAS_FMT
> -		 "reply_post_free pool: pci_pool_create failed\n",
> +		 "reply_post_free pool: dma_pool_create failed\n",
>  		 ioc->name);
>  		goto out;
>  	}
>  	i = 0;
>  	do {
>  		ioc->reply_post[i].reply_post_free =
> -		    pci_pool_alloc(ioc->reply_post_free_dma_pool,
> +		    dma_pool_alloc(ioc->reply_post_free_dma_pool,
>  		    GFP_KERNEL,
>  		    &ioc->reply_post[i].reply_post_free_dma);
>  		if (!ioc->reply_post[i].reply_post_free) {
>  			pr_err(MPT3SAS_FMT
> -			"reply_post_free pool: pci_pool_alloc failed\n",
> +			"reply_post_free pool: dma_pool_alloc failed\n",
>  			ioc->name);
>  			goto out;
>  		}
> @@ -3579,15 +3574,15 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  			ioc->name);
>  		goto out;
>  	}
> -	ioc->chain_dma_pool = pci_pool_create("chain pool", ioc->pdev,
> +	ioc->chain_dma_pool = dma_pool_create("chain pool", &ioc->pdev->dev,
>  	    ioc->chain_segment_sz, 16, 0);
>  	if (!ioc->chain_dma_pool) {
> -		pr_err(MPT3SAS_FMT "chain_dma_pool: pci_pool_create failed\n",
> +		pr_err(MPT3SAS_FMT "chain_dma_pool: dma_pool_create failed\n",
>  			ioc->name);
>  		goto out;
>  	}
>  	for (i = 0; i < ioc->chain_depth; i++) {
> -		ioc->chain_lookup[i].chain_buffer = pci_pool_alloc(
> +		ioc->chain_lookup[i].chain_buffer = dma_pool_alloc(
>  		    ioc->chain_dma_pool , GFP_KERNEL,
>  		    &ioc->chain_lookup[i].chain_buffer_dma);
>  		if (!ioc->chain_lookup[i].chain_buffer) {
> @@ -3632,17 +3627,17 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  
>  	/* sense buffers, 4 byte align */
>  	sz = ioc->scsiio_depth * SCSI_SENSE_BUFFERSIZE;
> -	ioc->sense_dma_pool = pci_pool_create("sense pool", ioc->pdev, sz, 4,
> -	    0);
> +	ioc->sense_dma_pool = dma_pool_create("sense pool", &ioc->pdev->dev, sz,
> +					      4, 0);
>  	if (!ioc->sense_dma_pool) {
> -		pr_err(MPT3SAS_FMT "sense pool: pci_pool_create failed\n",
> +		pr_err(MPT3SAS_FMT "sense pool: dma_pool_create failed\n",
>  		    ioc->name);
>  		goto out;
>  	}
> -	ioc->sense = pci_pool_alloc(ioc->sense_dma_pool , GFP_KERNEL,
> +	ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL,
>  	    &ioc->sense_dma);
>  	if (!ioc->sense) {
> -		pr_err(MPT3SAS_FMT "sense pool: pci_pool_alloc failed\n",
> +		pr_err(MPT3SAS_FMT "sense pool: dma_pool_alloc failed\n",
>  		    ioc->name);
>  		goto out;
>  	}
> @@ -3656,17 +3651,17 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  
>  	/* reply pool, 4 byte align */
>  	sz = ioc->reply_free_queue_depth * ioc->reply_sz;
> -	ioc->reply_dma_pool = pci_pool_create("reply pool", ioc->pdev, sz, 4,
> -	    0);
> +	ioc->reply_dma_pool = dma_pool_create("reply pool", &ioc->pdev->dev, sz,
> +					      4, 0);
>  	if (!ioc->reply_dma_pool) {
> -		pr_err(MPT3SAS_FMT "reply pool: pci_pool_create failed\n",
> +		pr_err(MPT3SAS_FMT "reply pool: dma_pool_create failed\n",
>  		    ioc->name);
>  		goto out;
>  	}
> -	ioc->reply = pci_pool_alloc(ioc->reply_dma_pool , GFP_KERNEL,
> +	ioc->reply = dma_pool_alloc(ioc->reply_dma_pool, GFP_KERNEL,
>  	    &ioc->reply_dma);
>  	if (!ioc->reply) {
> -		pr_err(MPT3SAS_FMT "reply pool: pci_pool_alloc failed\n",
> +		pr_err(MPT3SAS_FMT "reply pool: dma_pool_alloc failed\n",
>  		    ioc->name);
>  		goto out;
>  	}
> @@ -3682,17 +3677,17 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  
>  	/* reply free queue, 16 byte align */
>  	sz = ioc->reply_free_queue_depth * 4;
> -	ioc->reply_free_dma_pool = pci_pool_create("reply_free pool",
> -	    ioc->pdev, sz, 16, 0);
> +	ioc->reply_free_dma_pool = dma_pool_create("reply_free pool",
> +	    &ioc->pdev->dev, sz, 16, 0);
>  	if (!ioc->reply_free_dma_pool) {
> -		pr_err(MPT3SAS_FMT "reply_free pool: pci_pool_create failed\n",
> +		pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_create failed\n",
>  			ioc->name);
>  		goto out;
>  	}
> -	ioc->reply_free = pci_pool_alloc(ioc->reply_free_dma_pool , GFP_KERNEL,
> +	ioc->reply_free = dma_pool_alloc(ioc->reply_free_dma_pool, GFP_KERNEL,
>  	    &ioc->reply_free_dma);
>  	if (!ioc->reply_free) {
> -		pr_err(MPT3SAS_FMT "reply_free pool: pci_pool_alloc failed\n",
> +		pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_alloc failed\n",
>  			ioc->name);
>  		goto out;
>  	}
> @@ -3710,7 +3705,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  	    ioc->config_page_sz, &ioc->config_page_dma);
>  	if (!ioc->config_page) {
>  		pr_err(MPT3SAS_FMT
> -			"config page: pci_pool_alloc failed\n",
> +			"config page: dma_pool_alloc failed\n",
>  			ioc->name);
>  		goto out;
>  	}
> -- 
> 2.9.3
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 12/20] scsi: mpt3sas: Replace PCI pool old API
@ 2017-02-27 11:18       ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:18 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:17PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  drivers/scsi/mpt3sas/mpt3sas_base.c | 73 +++++++++++++++++--------------------
>  1 file changed, 34 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index 5b7aec5..5ae1c23 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -3200,9 +3200,8 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  	}
>  
>  	if (ioc->sense) {
> -		pci_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
> -		if (ioc->sense_dma_pool)
> -			pci_pool_destroy(ioc->sense_dma_pool);
> +		dma_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
> +		dma_pool_destroy(ioc->sense_dma_pool);
>  		dexitprintk(ioc, pr_info(MPT3SAS_FMT
>  			"sense_pool(0x%p): free\n",
>  			ioc->name, ioc->sense));
> @@ -3210,9 +3209,8 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  	}
>  
>  	if (ioc->reply) {
> -		pci_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
> -		if (ioc->reply_dma_pool)
> -			pci_pool_destroy(ioc->reply_dma_pool);
> +		dma_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
> +		dma_pool_destroy(ioc->reply_dma_pool);
>  		dexitprintk(ioc, pr_info(MPT3SAS_FMT
>  			"reply_pool(0x%p): free\n",
>  			ioc->name, ioc->reply));
> @@ -3220,10 +3218,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  	}
>  
>  	if (ioc->reply_free) {
> -		pci_pool_free(ioc->reply_free_dma_pool, ioc->reply_free,
> +		dma_pool_free(ioc->reply_free_dma_pool, ioc->reply_free,
>  		    ioc->reply_free_dma);
> -		if (ioc->reply_free_dma_pool)
> -			pci_pool_destroy(ioc->reply_free_dma_pool);
> +		dma_pool_destroy(ioc->reply_free_dma_pool);
>  		dexitprintk(ioc, pr_info(MPT3SAS_FMT
>  			"reply_free_pool(0x%p): free\n",
>  			ioc->name, ioc->reply_free));
> @@ -3234,7 +3231,7 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  		do {
>  			rps = &ioc->reply_post[i];
>  			if (rps->reply_post_free) {
> -				pci_pool_free(
> +				dma_pool_free(
>  				    ioc->reply_post_free_dma_pool,
>  				    rps->reply_post_free,
>  				    rps->reply_post_free_dma);
> @@ -3246,8 +3243,7 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  		} while (ioc->rdpq_array_enable &&
>  			   (++i < ioc->reply_queue_count));
>  
> -		if (ioc->reply_post_free_dma_pool)
> -			pci_pool_destroy(ioc->reply_post_free_dma_pool);
> +		dma_pool_destroy(ioc->reply_post_free_dma_pool);
>  		kfree(ioc->reply_post);
>  	}
>  
> @@ -3268,12 +3264,11 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  	if (ioc->chain_lookup) {
>  		for (i = 0; i < ioc->chain_depth; i++) {
>  			if (ioc->chain_lookup[i].chain_buffer)
> -				pci_pool_free(ioc->chain_dma_pool,
> +				dma_pool_free(ioc->chain_dma_pool,
>  				    ioc->chain_lookup[i].chain_buffer,
>  				    ioc->chain_lookup[i].chain_buffer_dma);
>  		}
> -		if (ioc->chain_dma_pool)
> -			pci_pool_destroy(ioc->chain_dma_pool);
> +		dma_pool_destroy(ioc->chain_dma_pool);
>  		free_pages((ulong)ioc->chain_lookup, ioc->chain_pages);
>  		ioc->chain_lookup = NULL;
>  	}
> @@ -3448,23 +3443,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  			ioc->name);
>  		goto out;
>  	}
> -	ioc->reply_post_free_dma_pool = pci_pool_create("reply_post_free pool",
> -	    ioc->pdev, sz, 16, 0);
> +	ioc->reply_post_free_dma_pool = dma_pool_create("reply_post_free pool",
> +	    &ioc->pdev->dev, sz, 16, 0);
>  	if (!ioc->reply_post_free_dma_pool) {
>  		pr_err(MPT3SAS_FMT
> -		 "reply_post_free pool: pci_pool_create failed\n",
> +		 "reply_post_free pool: dma_pool_create failed\n",
>  		 ioc->name);
>  		goto out;
>  	}
>  	i = 0;
>  	do {
>  		ioc->reply_post[i].reply_post_free =
> -		    pci_pool_alloc(ioc->reply_post_free_dma_pool,
> +		    dma_pool_alloc(ioc->reply_post_free_dma_pool,
>  		    GFP_KERNEL,
>  		    &ioc->reply_post[i].reply_post_free_dma);
>  		if (!ioc->reply_post[i].reply_post_free) {
>  			pr_err(MPT3SAS_FMT
> -			"reply_post_free pool: pci_pool_alloc failed\n",
> +			"reply_post_free pool: dma_pool_alloc failed\n",
>  			ioc->name);
>  			goto out;
>  		}
> @@ -3579,15 +3574,15 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  			ioc->name);
>  		goto out;
>  	}
> -	ioc->chain_dma_pool = pci_pool_create("chain pool", ioc->pdev,
> +	ioc->chain_dma_pool = dma_pool_create("chain pool", &ioc->pdev->dev,
>  	    ioc->chain_segment_sz, 16, 0);
>  	if (!ioc->chain_dma_pool) {
> -		pr_err(MPT3SAS_FMT "chain_dma_pool: pci_pool_create failed\n",
> +		pr_err(MPT3SAS_FMT "chain_dma_pool: dma_pool_create failed\n",
>  			ioc->name);
>  		goto out;
>  	}
>  	for (i = 0; i < ioc->chain_depth; i++) {
> -		ioc->chain_lookup[i].chain_buffer = pci_pool_alloc(
> +		ioc->chain_lookup[i].chain_buffer = dma_pool_alloc(
>  		    ioc->chain_dma_pool , GFP_KERNEL,
>  		    &ioc->chain_lookup[i].chain_buffer_dma);
>  		if (!ioc->chain_lookup[i].chain_buffer) {
> @@ -3632,17 +3627,17 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  
>  	/* sense buffers, 4 byte align */
>  	sz = ioc->scsiio_depth * SCSI_SENSE_BUFFERSIZE;
> -	ioc->sense_dma_pool = pci_pool_create("sense pool", ioc->pdev, sz, 4,
> -	    0);
> +	ioc->sense_dma_pool = dma_pool_create("sense pool", &ioc->pdev->dev, sz,
> +					      4, 0);
>  	if (!ioc->sense_dma_pool) {
> -		pr_err(MPT3SAS_FMT "sense pool: pci_pool_create failed\n",
> +		pr_err(MPT3SAS_FMT "sense pool: dma_pool_create failed\n",
>  		    ioc->name);
>  		goto out;
>  	}
> -	ioc->sense = pci_pool_alloc(ioc->sense_dma_pool , GFP_KERNEL,
> +	ioc->sense = dma_pool_alloc(ioc->sense_dma_pool, GFP_KERNEL,
>  	    &ioc->sense_dma);
>  	if (!ioc->sense) {
> -		pr_err(MPT3SAS_FMT "sense pool: pci_pool_alloc failed\n",
> +		pr_err(MPT3SAS_FMT "sense pool: dma_pool_alloc failed\n",
>  		    ioc->name);
>  		goto out;
>  	}
> @@ -3656,17 +3651,17 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  
>  	/* reply pool, 4 byte align */
>  	sz = ioc->reply_free_queue_depth * ioc->reply_sz;
> -	ioc->reply_dma_pool = pci_pool_create("reply pool", ioc->pdev, sz, 4,
> -	    0);
> +	ioc->reply_dma_pool = dma_pool_create("reply pool", &ioc->pdev->dev, sz,
> +					      4, 0);
>  	if (!ioc->reply_dma_pool) {
> -		pr_err(MPT3SAS_FMT "reply pool: pci_pool_create failed\n",
> +		pr_err(MPT3SAS_FMT "reply pool: dma_pool_create failed\n",
>  		    ioc->name);
>  		goto out;
>  	}
> -	ioc->reply = pci_pool_alloc(ioc->reply_dma_pool , GFP_KERNEL,
> +	ioc->reply = dma_pool_alloc(ioc->reply_dma_pool, GFP_KERNEL,
>  	    &ioc->reply_dma);
>  	if (!ioc->reply) {
> -		pr_err(MPT3SAS_FMT "reply pool: pci_pool_alloc failed\n",
> +		pr_err(MPT3SAS_FMT "reply pool: dma_pool_alloc failed\n",
>  		    ioc->name);
>  		goto out;
>  	}
> @@ -3682,17 +3677,17 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  
>  	/* reply free queue, 16 byte align */
>  	sz = ioc->reply_free_queue_depth * 4;
> -	ioc->reply_free_dma_pool = pci_pool_create("reply_free pool",
> -	    ioc->pdev, sz, 16, 0);
> +	ioc->reply_free_dma_pool = dma_pool_create("reply_free pool",
> +	    &ioc->pdev->dev, sz, 16, 0);
>  	if (!ioc->reply_free_dma_pool) {
> -		pr_err(MPT3SAS_FMT "reply_free pool: pci_pool_create failed\n",
> +		pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_create failed\n",
>  			ioc->name);
>  		goto out;
>  	}
> -	ioc->reply_free = pci_pool_alloc(ioc->reply_free_dma_pool , GFP_KERNEL,
> +	ioc->reply_free = dma_pool_alloc(ioc->reply_free_dma_pool, GFP_KERNEL,
>  	    &ioc->reply_free_dma);
>  	if (!ioc->reply_free) {
> -		pr_err(MPT3SAS_FMT "reply_free pool: pci_pool_alloc failed\n",
> +		pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_alloc failed\n",
>  			ioc->name);
>  		goto out;
>  	}
> @@ -3710,7 +3705,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  	    ioc->config_page_sz, &ioc->config_page_dma);
>  	if (!ioc->config_page) {
>  		pr_err(MPT3SAS_FMT
> -			"config page: pci_pool_alloc failed\n",
> +			"config page: dma_pool_alloc failed\n",
>  			ioc->name);
>  		goto out;
>  	}
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 13/20] scsi: mvsas: Replace PCI pool old API
       [not found] ` <20170226192425.13098-14-romain.perier@collabora.com>
@ 2017-02-27 11:18   ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:18 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:18PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  drivers/scsi/mvsas/mv_init.c | 6 +++---
>  drivers/scsi/mvsas/mv_sas.c  | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
> index 8280046..41d2276 100644
> --- a/drivers/scsi/mvsas/mv_init.c
> +++ b/drivers/scsi/mvsas/mv_init.c
> @@ -125,8 +125,7 @@ static void mvs_free(struct mvs_info *mvi)
>  	else
>  		slot_nr = MVS_CHIP_SLOT_SZ;
>  
> -	if (mvi->dma_pool)
> -		pci_pool_destroy(mvi->dma_pool);
> +	dma_pool_destroy(mvi->dma_pool);
>  
>  	if (mvi->tx)
>  		dma_free_coherent(mvi->dev,
> @@ -296,7 +295,8 @@ static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)
>  		goto err_out;
>  
>  	sprintf(pool_name, "%s%d", "mvs_dma_pool", mvi->id);
> -	mvi->dma_pool = pci_pool_create(pool_name, mvi->pdev, MVS_SLOT_BUF_SZ, 16, 0);
> +	mvi->dma_pool = dma_pool_create(pool_name, &mvi->pdev->dev,
> +					MVS_SLOT_BUF_SZ, 16, 0);
>  	if (!mvi->dma_pool) {
>  			printk(KERN_DEBUG "failed to create dma pool %s.\n", pool_name);
>  			goto err_out;
> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
> index c7cc803..ee81d10 100644
> --- a/drivers/scsi/mvsas/mv_sas.c
> +++ b/drivers/scsi/mvsas/mv_sas.c
> @@ -790,7 +790,7 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf
>  	slot->n_elem = n_elem;
>  	slot->slot_tag = tag;
>  
> -	slot->buf = pci_pool_alloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
> +	slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
>  	if (!slot->buf) {
>  		rc = -ENOMEM;
>  		goto err_out_tag;
> @@ -840,7 +840,7 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf
>  	return rc;
>  
>  err_out_slot_buf:
> -	pci_pool_free(mvi->dma_pool, slot->buf, slot->buf_dma);
> +	dma_pool_free(mvi->dma_pool, slot->buf, slot->buf_dma);
>  err_out_tag:
>  	mvs_tag_free(mvi, tag);
>  err_out:
> @@ -918,7 +918,7 @@ static void mvs_slot_task_free(struct mvs_info *mvi, struct sas_task *task,
>  	}
>  
>  	if (slot->buf) {
> -		pci_pool_free(mvi->dma_pool, slot->buf, slot->buf_dma);
> +		dma_pool_free(mvi->dma_pool, slot->buf, slot->buf_dma);
>  		slot->buf = NULL;
>  	}
>  	list_del_init(&slot->entry);
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 17/20] usb: gadget: pch_udc: Replace PCI pool old API
       [not found] ` <20170226192425.13098-18-romain.perier@collabora.com>
@ 2017-02-27 11:19   ` Peter Senna Tschudin
  2017-03-06 14:46     ` Felipe Balbi
  0 siblings, 1 reply; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:19 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:22PM +0100, Romain Perier wrote:
> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  drivers/usb/gadget/udc/pch_udc.c | 31 +++++++++++++++----------------
>  1 file changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c
> index a97da64..84dcbcd 100644
> --- a/drivers/usb/gadget/udc/pch_udc.c
> +++ b/drivers/usb/gadget/udc/pch_udc.c
> @@ -355,8 +355,8 @@ struct pch_udc_dev {
>  			vbus_session:1,
>  			set_cfg_not_acked:1,
>  			waiting_zlp_ack:1;
> -	struct pci_pool		*data_requests;
> -	struct pci_pool		*stp_requests;
> +	struct dma_pool		*data_requests;
> +	struct dma_pool		*stp_requests;
>  	dma_addr_t			dma_addr;
>  	struct usb_ctrlrequest		setup_data;
>  	void __iomem			*base_addr;
> @@ -1522,7 +1522,7 @@ static void pch_udc_free_dma_chain(struct pch_udc_dev *dev,
>  		/* do not free first desc., will be done by free for request */
>  		td = phys_to_virt(addr);
>  		addr2 = (dma_addr_t)td->next;
> -		pci_pool_free(dev->data_requests, td, addr);
> +		dma_pool_free(dev->data_requests, td, addr);
>  		td->next = 0x00;
>  		addr = addr2;
>  	}
> @@ -1539,7 +1539,7 @@ static void pch_udc_free_dma_chain(struct pch_udc_dev *dev,
>   *
>   * Return codes:
>   *	0:		success,
> - *	-ENOMEM:	pci_pool_alloc invocation fails
> + *	-ENOMEM:	dma_pool_alloc invocation fails
>   */
>  static int pch_udc_create_dma_chain(struct pch_udc_ep *ep,
>  				    struct pch_udc_request *req,
> @@ -1565,7 +1565,7 @@ static int pch_udc_create_dma_chain(struct pch_udc_ep *ep,
>  		if (bytes <= buf_len)
>  			break;
>  		last = td;
> -		td = pci_pool_alloc(ep->dev->data_requests, gfp_flags,
> +		td = dma_pool_alloc(ep->dev->data_requests, gfp_flags,
>  				    &dma_addr);
>  		if (!td)
>  			goto nomem;
> @@ -1770,7 +1770,7 @@ static struct usb_request *pch_udc_alloc_request(struct usb_ep *usbep,
>  	if (!ep->dev->dma_addr)
>  		return &req->req;
>  	/* ep0 in requests are allocated from data pool here */
> -	dma_desc = pci_pool_alloc(ep->dev->data_requests, gfp,
> +	dma_desc = dma_pool_alloc(ep->dev->data_requests, gfp,
>  				  &req->td_data_phys);
>  	if (NULL == dma_desc) {
>  		kfree(req);
> @@ -1809,7 +1809,7 @@ static void pch_udc_free_request(struct usb_ep *usbep,
>  	if (req->td_data != NULL) {
>  		if (req->chain_len > 1)
>  			pch_udc_free_dma_chain(ep->dev, req);
> -		pci_pool_free(ep->dev->data_requests, req->td_data,
> +		dma_pool_free(ep->dev->data_requests, req->td_data,
>  			      req->td_data_phys);
>  	}
>  	kfree(req);
> @@ -2914,7 +2914,7 @@ static int init_dma_pools(struct pch_udc_dev *dev)
>  	void				*ep0out_buf;
>  
>  	/* DMA setup */
> -	dev->data_requests = pci_pool_create("data_requests", dev->pdev,
> +	dev->data_requests = dma_pool_create("data_requests", &dev->pdev->dev,
>  		sizeof(struct pch_udc_data_dma_desc), 0, 0);
>  	if (!dev->data_requests) {
>  		dev_err(&dev->pdev->dev, "%s: can't get request data pool\n",
> @@ -2923,7 +2923,7 @@ static int init_dma_pools(struct pch_udc_dev *dev)
>  	}
>  
>  	/* dma desc for setup data */
> -	dev->stp_requests = pci_pool_create("setup requests", dev->pdev,
> +	dev->stp_requests = dma_pool_create("setup requests", &dev->pdev->dev,
>  		sizeof(struct pch_udc_stp_dma_desc), 0, 0);
>  	if (!dev->stp_requests) {
>  		dev_err(&dev->pdev->dev, "%s: can't get setup request pool\n",
> @@ -2931,7 +2931,7 @@ static int init_dma_pools(struct pch_udc_dev *dev)
>  		return -ENOMEM;
>  	}
>  	/* setup */
> -	td_stp = pci_pool_alloc(dev->stp_requests, GFP_KERNEL,
> +	td_stp = dma_pool_alloc(dev->stp_requests, GFP_KERNEL,
>  				&dev->ep[UDC_EP0OUT_IDX].td_stp_phys);
>  	if (!td_stp) {
>  		dev_err(&dev->pdev->dev,
> @@ -2941,7 +2941,7 @@ static int init_dma_pools(struct pch_udc_dev *dev)
>  	dev->ep[UDC_EP0OUT_IDX].td_stp = td_stp;
>  
>  	/* data: 0 packets !? */
> -	td_data = pci_pool_alloc(dev->data_requests, GFP_KERNEL,
> +	td_data = dma_pool_alloc(dev->data_requests, GFP_KERNEL,
>  				&dev->ep[UDC_EP0OUT_IDX].td_data_phys);
>  	if (!td_data) {
>  		dev_err(&dev->pdev->dev,
> @@ -3021,22 +3021,21 @@ static void pch_udc_remove(struct pci_dev *pdev)
>  		dev_err(&pdev->dev,
>  			"%s: gadget driver still bound!!!\n", __func__);
>  	/* dma pool cleanup */
> -	if (dev->data_requests)
> -		pci_pool_destroy(dev->data_requests);
> +	dma_pool_destroy(dev->data_requests);
>  
>  	if (dev->stp_requests) {
>  		/* cleanup DMA desc's for ep0in */
>  		if (dev->ep[UDC_EP0OUT_IDX].td_stp) {
> -			pci_pool_free(dev->stp_requests,
> +			dma_pool_free(dev->stp_requests,
>  				dev->ep[UDC_EP0OUT_IDX].td_stp,
>  				dev->ep[UDC_EP0OUT_IDX].td_stp_phys);
>  		}
>  		if (dev->ep[UDC_EP0OUT_IDX].td_data) {
> -			pci_pool_free(dev->stp_requests,
> +			dma_pool_free(dev->stp_requests,
>  				dev->ep[UDC_EP0OUT_IDX].td_data,
>  				dev->ep[UDC_EP0OUT_IDX].td_data_phys);
>  		}
> -		pci_pool_destroy(dev->stp_requests);
> +		dma_pool_destroy(dev->stp_requests);
>  	}
>  
>  	if (dev->dma_addr)
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 18/20] usb: host: Remove remaining pci_pool in comments
       [not found] ` <20170226192425.13098-19-romain.perier@collabora.com>
@ 2017-02-27 11:20   ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:20 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:23PM +0100, Romain Perier wrote:
> This replaces remaining occurences of pci_pool by dma_pool, as
> this is the new API that could be used for that purpose.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  drivers/usb/host/ehci-hcd.c     | 2 +-
>  drivers/usb/host/fotg210-hcd.c  | 2 +-
>  drivers/usb/host/oxu210hp-hcd.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index ac2c4ea..6e834b83 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -597,7 +597,7 @@ static int ehci_run (struct usb_hcd *hcd)
>  	/*
>  	 * hcc_params controls whether ehci->regs->segment must (!!!)
>  	 * be used; it constrains QH/ITD/SITD and QTD locations.
> -	 * pci_pool consistent memory always uses segment zero.
> +	 * dma_pool consistent memory always uses segment zero.
>  	 * streaming mappings for I/O buffers, like pci_map_single(),
>  	 * can return segments above 4GB, if the device allows.
>  	 *
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 1c5b34b..ced08dc 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -5047,7 +5047,7 @@ static int fotg210_run(struct usb_hcd *hcd)
>  	/*
>  	 * hcc_params controls whether fotg210->regs->segment must (!!!)
>  	 * be used; it constrains QH/ITD/SITD and QTD locations.
> -	 * pci_pool consistent memory always uses segment zero.
> +	 * dma_pool consistent memory always uses segment zero.
>  	 * streaming mappings for I/O buffers, like pci_map_single(),
>  	 * can return segments above 4GB, if the device allows.
>  	 *
> diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
> index bcf531c..ed20fb3 100644
> --- a/drivers/usb/host/oxu210hp-hcd.c
> +++ b/drivers/usb/host/oxu210hp-hcd.c
> @@ -2708,7 +2708,7 @@ static int oxu_run(struct usb_hcd *hcd)
>  
>  	/* hcc_params controls whether oxu->regs->segment must (!!!)
>  	 * be used; it constrains QH/ITD/SITD and QTD locations.
> -	 * pci_pool consistent memory always uses segment zero.
> +	 * dma_pool consistent memory always uses segment zero.
>  	 * streaming mappings for I/O buffers, like pci_map_single(),
>  	 * can return segments above 4GB, if the device allows.
>  	 *
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 19/20] PCI: Remove PCI pool macro functions
       [not found] ` <20170226192425.13098-20-romain.perier@collabora.com>
@ 2017-02-27 11:20   ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:20 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:24PM +0100, Romain Perier wrote:
> Now that all the drivers use dma pool API, we can remove the macro
> functions for PCI pool.
> 
Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  include/linux/pci.h | 9 ---------
>  1 file changed, 9 deletions(-)
> 
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 282ed32..d206ba4 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1281,15 +1281,6 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode,
>  #include <linux/pci-dma.h>
>  #include <linux/dmapool.h>
>  
> -#define	pci_pool dma_pool
> -#define pci_pool_create(name, pdev, size, align, allocation) \
> -		dma_pool_create(name, &pdev->dev, size, align, allocation)
> -#define	pci_pool_destroy(pool) dma_pool_destroy(pool)
> -#define	pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle)
> -#define	pci_pool_zalloc(pool, flags, handle) \
> -		dma_pool_zalloc(pool, flags, handle)
> -#define	pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr)
> -
>  struct msix_entry {
>  	u32	vector;	/* kernel uses to write allocated vector */
>  	u16	entry;	/* driver uses to specify entry, OS writes */
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API
       [not found] ` <20170226192425.13098-21-romain.perier@collabora.com>
@ 2017-02-27 11:22       ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:22 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w, David S. Miller,
	stas.yakovlev-Re5JQEeQqe8AvxtiuMwx3w, James E.J. Bottomley,
	Martin K. Petersen, Felipe Balbi, Greg Kroah-Hartman,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Peter Senna Tschudin,
	Joe Perches

On Sun, Feb 26, 2017 at 08:24:25PM +0100, Romain Perier wrote:
> pci_pool_*() functions should be replaced by the corresponding functions
> in the DMA pool API. This adds support to check for use of these pci
> functions and display a warning when it is the case.
>

I guess Joe Perches did sent some comments for this one, did you address
them?

Reviewed-by: Peter Senna Tschudin <peter.senna-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> Signed-off-by: Romain Perier <romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> ---
>  scripts/checkpatch.pl | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index baa3c7b..f2c775c 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6064,7 +6064,14 @@ sub process {
>  			WARN("USE_DEVICE_INITCALL",
>  			     "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
>  		}
> -
> +# check for old PCI api pci_pool_*(), use dma_pool_*() instead
> +		if ($line =~ /\bpci_pool(?:_(?:create|destroy|alloc|zalloc|free)|)\b/) {
> +			if (WARN("USE_DMA_POOL",
> +				 "please use the dma pool api or more appropriate function instead of the old pci pool api\n" . $herecurr) &&
> +			    $fix) {
> +				while ($fixed[$fixlinenr] =~ s/\bpci_pool(_(?:create|destroy|alloc|zalloc|free)|)\b/dma_pool$1/) {}
> +			}
> +		}
>  # check for various structs that are normally const (ops, kgdb, device_tree)
>  		if ($line !~ /\bconst\b/ &&
>  		    $line =~ /\bstruct\s+($const_structs)\b/) {
> -- 
> 2.9.3
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API
@ 2017-02-27 11:22       ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:22 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin, Joe Perches

On Sun, Feb 26, 2017 at 08:24:25PM +0100, Romain Perier wrote:
> pci_pool_*() functions should be replaced by the corresponding functions
> in the DMA pool API. This adds support to check for use of these pci
> functions and display a warning when it is the case.
>

I guess Joe Perches did sent some comments for this one, did you address
them?

Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  scripts/checkpatch.pl | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index baa3c7b..f2c775c 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6064,7 +6064,14 @@ sub process {
>  			WARN("USE_DEVICE_INITCALL",
>  			     "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
>  		}
> -
> +# check for old PCI api pci_pool_*(), use dma_pool_*() instead
> +		if ($line =~ /\bpci_pool(?:_(?:create|destroy|alloc|zalloc|free)|)\b/) {
> +			if (WARN("USE_DMA_POOL",
> +				 "please use the dma pool api or more appropriate function instead of the old pci pool api\n" . $herecurr) &&
> +			    $fix) {
> +				while ($fixed[$fixlinenr] =~ s/\bpci_pool(_(?:create|destroy|alloc|zalloc|free)|)\b/dma_pool$1/) {}
> +			}
> +		}
>  # check for various structs that are normally const (ops, kgdb, device_tree)
>  		if ($line !~ /\bconst\b/ &&
>  		    $line =~ /\bstruct\s+($const_structs)\b/) {
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 00/20] Replace PCI pool by DMA pool API
       [not found] <20170226192425.13098-1-romain.perier@collabora.com>
@ 2017-02-27 11:23     ` Peter Senna Tschudin
       [not found] ` <20170226192425.13098-8-romain.perier@collabora.com>
                       ` (10 subsequent siblings)
  11 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:23 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w, David S. Miller,
	stas.yakovlev-Re5JQEeQqe8AvxtiuMwx3w, James E.J. Bottomley,
	Martin K. Petersen, Felipe Balbi, Greg Kroah-Hartman,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:05PM +0100, Romain Perier wrote:
> The current PCI pool API are simple macro functions direct expanded to
> the appropriated dma pool functions. The prototypes are almost the same
> and semantically, they are very similar. I propose to use the DMA pool
> API directly and get rid of the old API.
> 
> This set of patches, replaces the old API by the dma pool API, adds
> support to warn about this old API in checkpath.pl and remove the
> defines.
> 
> Changes in v3:
> - Rebased series onto next-20170224
> - Fix checkpath.pl reports for patch 11/20 and patch 12/20
> - Remove prefix RFC
> Changes in v2:
> - Introduced patch 18/20
> - Fixed cosmetic changes: spaces before brace, live over 80 characters
> - Removed some of the check for NULL pointers before calling dma_pool_destroy
> - Improved the regexp in checkpatch for pci_pool, thanks to Joe Perches
> - Added Tested-by and Acked-by tags

Tested the series with checkpatch and compiling with allyesconfig.

> 
> Romain Perier (20):
>   block: DAC960: Replace PCI pool old API
>   dmaengine: pch_dma: Replace PCI pool old API
>   IB/mthca: Replace PCI pool old API
>   net: e100: Replace PCI pool old API
>   mlx4: Replace PCI pool old API
>   mlx5: Replace PCI pool old API
>   wireless: ipw2200: Replace PCI pool old API
>   scsi: be2iscsi: Replace PCI pool old API
>   scsi: csiostor: Replace PCI pool old API
>   scsi: lpfc: Replace PCI pool old API
>   scsi: megaraid: Replace PCI pool old API
>   scsi: mpt3sas: Replace PCI pool old API
>   scsi: mvsas: Replace PCI pool old API
>   scsi: pmcraid: Replace PCI pool old API
>   usb: gadget: amd5536udc: Replace PCI pool old API
>   usb: gadget: net2280: Replace PCI pool old API
>   usb: gadget: pch_udc: Replace PCI pool old API
>   usb: host: Remove remaining pci_pool in comments
>   PCI: Remove PCI pool macro functions
>   checkpatch: warn for use of old PCI pool API
> 
>  drivers/block/DAC960.c                        |  36 ++++-----
>  drivers/block/DAC960.h                        |   4 +-
>  drivers/dma/pch_dma.c                         |  12 +--
>  drivers/infiniband/hw/mthca/mthca_av.c        |  10 +--
>  drivers/infiniband/hw/mthca/mthca_cmd.c       |   8 +-
>  drivers/infiniband/hw/mthca/mthca_dev.h       |   4 +-
>  drivers/net/ethernet/intel/e100.c             |  12 +--
>  drivers/net/ethernet/mellanox/mlx4/cmd.c      |  10 +--
>  drivers/net/ethernet/mellanox/mlx4/mlx4.h     |   2 +-
>  drivers/net/ethernet/mellanox/mlx5/core/cmd.c |  11 +--
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  13 ++--
>  drivers/scsi/be2iscsi/be_iscsi.c              |   6 +-
>  drivers/scsi/be2iscsi/be_main.c               |   6 +-
>  drivers/scsi/be2iscsi/be_main.h               |   2 +-
>  drivers/scsi/csiostor/csio_hw.h               |   2 +-
>  drivers/scsi/csiostor/csio_init.c             |  11 +--
>  drivers/scsi/csiostor/csio_scsi.c             |   6 +-
>  drivers/scsi/lpfc/lpfc.h                      |  12 +--
>  drivers/scsi/lpfc/lpfc_init.c                 |  16 ++--
>  drivers/scsi/lpfc/lpfc_mem.c                  | 105 +++++++++++++-------------
>  drivers/scsi/lpfc/lpfc_nvme.c                 |   6 +-
>  drivers/scsi/lpfc/lpfc_nvmet.c                |   4 +-
>  drivers/scsi/lpfc/lpfc_scsi.c                 |  12 +--
>  drivers/scsi/megaraid/megaraid_mbox.c         |  33 ++++----
>  drivers/scsi/megaraid/megaraid_mm.c           |  32 ++++----
>  drivers/scsi/megaraid/megaraid_sas_base.c     |  29 +++----
>  drivers/scsi/megaraid/megaraid_sas_fusion.c   |  66 ++++++++--------
>  drivers/scsi/mpt3sas/mpt3sas_base.c           |  73 +++++++++---------
>  drivers/scsi/mvsas/mv_init.c                  |   6 +-
>  drivers/scsi/mvsas/mv_sas.c                   |   6 +-
>  drivers/scsi/pmcraid.c                        |  10 +--
>  drivers/scsi/pmcraid.h                        |   2 +-
>  drivers/usb/gadget/udc/amd5536udc.c           |   8 +-
>  drivers/usb/gadget/udc/amd5536udc.h           |   4 +-
>  drivers/usb/gadget/udc/net2280.c              |  12 +--
>  drivers/usb/gadget/udc/net2280.h              |   2 +-
>  drivers/usb/gadget/udc/pch_udc.c              |  31 ++++----
>  drivers/usb/host/ehci-hcd.c                   |   2 +-
>  drivers/usb/host/fotg210-hcd.c                |   2 +-
>  drivers/usb/host/oxu210hp-hcd.c               |   2 +-
>  include/linux/mlx5/driver.h                   |   2 +-
>  include/linux/pci.h                           |   9 ---
>  scripts/checkpatch.pl                         |   9 ++-
>  43 files changed, 318 insertions(+), 332 deletions(-)
> 
> -- 
> 2.9.3
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 00/20] Replace PCI pool by DMA pool API
@ 2017-02-27 11:23     ` Peter Senna Tschudin
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Senna Tschudin @ 2017-02-27 11:23 UTC (permalink / raw)
  To: Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Sun, Feb 26, 2017 at 08:24:05PM +0100, Romain Perier wrote:
> The current PCI pool API are simple macro functions direct expanded to
> the appropriated dma pool functions. The prototypes are almost the same
> and semantically, they are very similar. I propose to use the DMA pool
> API directly and get rid of the old API.
> 
> This set of patches, replaces the old API by the dma pool API, adds
> support to warn about this old API in checkpath.pl and remove the
> defines.
> 
> Changes in v3:
> - Rebased series onto next-20170224
> - Fix checkpath.pl reports for patch 11/20 and patch 12/20
> - Remove prefix RFC
> Changes in v2:
> - Introduced patch 18/20
> - Fixed cosmetic changes: spaces before brace, live over 80 characters
> - Removed some of the check for NULL pointers before calling dma_pool_destroy
> - Improved the regexp in checkpatch for pci_pool, thanks to Joe Perches
> - Added Tested-by and Acked-by tags

Tested the series with checkpatch and compiling with allyesconfig.

> 
> Romain Perier (20):
>   block: DAC960: Replace PCI pool old API
>   dmaengine: pch_dma: Replace PCI pool old API
>   IB/mthca: Replace PCI pool old API
>   net: e100: Replace PCI pool old API
>   mlx4: Replace PCI pool old API
>   mlx5: Replace PCI pool old API
>   wireless: ipw2200: Replace PCI pool old API
>   scsi: be2iscsi: Replace PCI pool old API
>   scsi: csiostor: Replace PCI pool old API
>   scsi: lpfc: Replace PCI pool old API
>   scsi: megaraid: Replace PCI pool old API
>   scsi: mpt3sas: Replace PCI pool old API
>   scsi: mvsas: Replace PCI pool old API
>   scsi: pmcraid: Replace PCI pool old API
>   usb: gadget: amd5536udc: Replace PCI pool old API
>   usb: gadget: net2280: Replace PCI pool old API
>   usb: gadget: pch_udc: Replace PCI pool old API
>   usb: host: Remove remaining pci_pool in comments
>   PCI: Remove PCI pool macro functions
>   checkpatch: warn for use of old PCI pool API
> 
>  drivers/block/DAC960.c                        |  36 ++++-----
>  drivers/block/DAC960.h                        |   4 +-
>  drivers/dma/pch_dma.c                         |  12 +--
>  drivers/infiniband/hw/mthca/mthca_av.c        |  10 +--
>  drivers/infiniband/hw/mthca/mthca_cmd.c       |   8 +-
>  drivers/infiniband/hw/mthca/mthca_dev.h       |   4 +-
>  drivers/net/ethernet/intel/e100.c             |  12 +--
>  drivers/net/ethernet/mellanox/mlx4/cmd.c      |  10 +--
>  drivers/net/ethernet/mellanox/mlx4/mlx4.h     |   2 +-
>  drivers/net/ethernet/mellanox/mlx5/core/cmd.c |  11 +--
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  13 ++--
>  drivers/scsi/be2iscsi/be_iscsi.c              |   6 +-
>  drivers/scsi/be2iscsi/be_main.c               |   6 +-
>  drivers/scsi/be2iscsi/be_main.h               |   2 +-
>  drivers/scsi/csiostor/csio_hw.h               |   2 +-
>  drivers/scsi/csiostor/csio_init.c             |  11 +--
>  drivers/scsi/csiostor/csio_scsi.c             |   6 +-
>  drivers/scsi/lpfc/lpfc.h                      |  12 +--
>  drivers/scsi/lpfc/lpfc_init.c                 |  16 ++--
>  drivers/scsi/lpfc/lpfc_mem.c                  | 105 +++++++++++++-------------
>  drivers/scsi/lpfc/lpfc_nvme.c                 |   6 +-
>  drivers/scsi/lpfc/lpfc_nvmet.c                |   4 +-
>  drivers/scsi/lpfc/lpfc_scsi.c                 |  12 +--
>  drivers/scsi/megaraid/megaraid_mbox.c         |  33 ++++----
>  drivers/scsi/megaraid/megaraid_mm.c           |  32 ++++----
>  drivers/scsi/megaraid/megaraid_sas_base.c     |  29 +++----
>  drivers/scsi/megaraid/megaraid_sas_fusion.c   |  66 ++++++++--------
>  drivers/scsi/mpt3sas/mpt3sas_base.c           |  73 +++++++++---------
>  drivers/scsi/mvsas/mv_init.c                  |   6 +-
>  drivers/scsi/mvsas/mv_sas.c                   |   6 +-
>  drivers/scsi/pmcraid.c                        |  10 +--
>  drivers/scsi/pmcraid.h                        |   2 +-
>  drivers/usb/gadget/udc/amd5536udc.c           |   8 +-
>  drivers/usb/gadget/udc/amd5536udc.h           |   4 +-
>  drivers/usb/gadget/udc/net2280.c              |  12 +--
>  drivers/usb/gadget/udc/net2280.h              |   2 +-
>  drivers/usb/gadget/udc/pch_udc.c              |  31 ++++----
>  drivers/usb/host/ehci-hcd.c                   |   2 +-
>  drivers/usb/host/fotg210-hcd.c                |   2 +-
>  drivers/usb/host/oxu210hp-hcd.c               |   2 +-
>  include/linux/mlx5/driver.h                   |   2 +-
>  include/linux/pci.h                           |   9 ---
>  scripts/checkpatch.pl                         |   9 ++-
>  43 files changed, 318 insertions(+), 332 deletions(-)
> 
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API
  2017-02-27 11:22       ` Peter Senna Tschudin
  (?)
@ 2017-02-27 11:53       ` Joe Perches
  -1 siblings, 0 replies; 26+ messages in thread
From: Joe Perches @ 2017-02-27 11:53 UTC (permalink / raw)
  To: Peter Senna Tschudin, Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Mon, 2017-02-27 at 12:22 +0100, Peter Senna Tschudin wrote:
> On Sun, Feb 26, 2017 at 08:24:25PM +0100, Romain Perier wrote:
> > pci_pool_*() functions should be replaced by the corresponding functions
> > in the DMA pool API. This adds support to check for use of these pci
> > functions and display a warning when it is the case.
> > 
> 
> I guess Joe Perches did sent some comments for this one, did you address
> them?


> Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> > Signed-off-by: Romain Perier <romain.perier@collabora.com>
> > ---
> >  scripts/checkpatch.pl | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index baa3c7b..f2c775c 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -6064,7 +6064,14 @@ sub process {
> >  			WARN("USE_DEVICE_INITCALL",
> >  			     "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
> >  		}
> > -
> > +# check for old PCI api pci_pool_*(), use dma_pool_*() instead
> > +		if ($line =~ /\bpci_pool(?:_(?:create|destroy|alloc|zalloc|free)|)\b/) {
> > +			if (WARN("USE_DMA_POOL",
> > +				 "please use the dma pool api or more appropriate function instead of the old pci pool api\n" . $herecurr) &&
> > +			    $fix) {
> > +				while ($fixed[$fixlinenr] =~ s/\bpci_pool(_(?:create|destroy|alloc|zalloc|free)|)\b/dma_pool$1/) {}
> > +			}
> > +		}
> >  # check for various structs that are normally const (ops, kgdb, device_tree)
> >  		if ($line !~ /\bconst\b/ &&
> >  		    $line =~ /\bstruct\s+($const_structs)\b/) {
> > 

This is nearly identical to the suggestion that I
sent but this is slightly misformatted as it does
not have a leading nor a trailing blank line to
separate the test blocks.

Also, I think none of the patches have reached lkml.

Romain, are you using git-send-email to send these
patches?  Perhaps the patches you send also contain
html which are rejected by the mailing list.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API
  2017-02-27 11:22       ` Peter Senna Tschudin
@ 2017-02-27 12:26           ` Romain Perier
  -1 siblings, 0 replies; 26+ messages in thread
From: Romain Perier @ 2017-02-27 12:26 UTC (permalink / raw)
  To: Peter Senna Tschudin
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w, David S. Miller,
	stas.yakovlev-Re5JQEeQqe8AvxtiuMwx3w, James E.J. Bottomley,
	Martin K. Petersen, Felipe Balbi, Greg Kroah-Hartman,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Peter Senna Tschudin,
	Joe Perches

Hello,


Le 27/02/2017 à 12:22, Peter Senna Tschudin a écrit :
> On Sun, Feb 26, 2017 at 08:24:25PM +0100, Romain Perier wrote:
>> pci_pool_*() functions should be replaced by the corresponding functions
>> in the DMA pool API. This adds support to check for use of these pci
>> functions and display a warning when it is the case.
>>
> I guess Joe Perches did sent some comments for this one, did you address
> them?

See the changelog of 00/20 (for v2). I have already integrated his
comments :)

>
> Reviewed-by: Peter Senna Tschudin <peter.senna-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
>> Signed-off-by: Romain Perier <romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
>> ---
>>  scripts/checkpatch.pl | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index baa3c7b..f2c775c 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -6064,7 +6064,14 @@ sub process {
>>  			WARN("USE_DEVICE_INITCALL",
>>  			     "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
>>  		}
>> -
>> +# check for old PCI api pci_pool_*(), use dma_pool_*() instead
>> +		if ($line =~ /\bpci_pool(?:_(?:create|destroy|alloc|zalloc|free)|)\b/) {
>> +			if (WARN("USE_DMA_POOL",
>> +				 "please use the dma pool api or more appropriate function instead of the old pci pool api\n" . $herecurr) &&
>> +			    $fix) {
>> +				while ($fixed[$fixlinenr] =~ s/\bpci_pool(_(?:create|destroy|alloc|zalloc|free)|)\b/dma_pool$1/) {}
>> +			}
>> +		}
>>  # check for various structs that are normally const (ops, kgdb, device_tree)
>>  		if ($line !~ /\bconst\b/ &&
>>  		    $line =~ /\bstruct\s+($const_structs)\b/) {
>> -- 
>> 2.9.3
>>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API
@ 2017-02-27 12:26           ` Romain Perier
  0 siblings, 0 replies; 26+ messages in thread
From: Romain Perier @ 2017-02-27 12:26 UTC (permalink / raw)
  To: Peter Senna Tschudin
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin, Joe Perches

Hello,


Le 27/02/2017 à 12:22, Peter Senna Tschudin a écrit :
> On Sun, Feb 26, 2017 at 08:24:25PM +0100, Romain Perier wrote:
>> pci_pool_*() functions should be replaced by the corresponding functions
>> in the DMA pool API. This adds support to check for use of these pci
>> functions and display a warning when it is the case.
>>
> I guess Joe Perches did sent some comments for this one, did you address
> them?

See the changelog of 00/20 (for v2). I have already integrated his
comments :)

>
> Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
>> Signed-off-by: Romain Perier <romain.perier@collabora.com>
>> ---
>>  scripts/checkpatch.pl | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index baa3c7b..f2c775c 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -6064,7 +6064,14 @@ sub process {
>>  			WARN("USE_DEVICE_INITCALL",
>>  			     "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
>>  		}
>> -
>> +# check for old PCI api pci_pool_*(), use dma_pool_*() instead
>> +		if ($line =~ /\bpci_pool(?:_(?:create|destroy|alloc|zalloc|free)|)\b/) {
>> +			if (WARN("USE_DMA_POOL",
>> +				 "please use the dma pool api or more appropriate function instead of the old pci pool api\n" . $herecurr) &&
>> +			    $fix) {
>> +				while ($fixed[$fixlinenr] =~ s/\bpci_pool(_(?:create|destroy|alloc|zalloc|free)|)\b/dma_pool$1/) {}
>> +			}
>> +		}
>>  # check for various structs that are normally const (ops, kgdb, device_tree)
>>  		if ($line !~ /\bconst\b/ &&
>>  		    $line =~ /\bstruct\s+($const_structs)\b/) {
>> -- 
>> 2.9.3
>>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API
  2017-02-27 12:26           ` Romain Perier
  (?)
@ 2017-02-27 12:38           ` Joe Perches
  2017-02-27 12:52             ` Romain Perier
  -1 siblings, 1 reply; 26+ messages in thread
From: Joe Perches @ 2017-02-27 12:38 UTC (permalink / raw)
  To: Romain Perier, Peter Senna Tschudin
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Mon, 2017-02-27 at 13:26 +0100, Romain Perier wrote:
> Hello,
> 
> 
> Le 27/02/2017 à 12:22, Peter Senna Tschudin a écrit :
> > On Sun, Feb 26, 2017 at 08:24:25PM +0100, Romain Perier wrote:
> > > pci_pool_*() functions should be replaced by the corresponding functions
> > > in the DMA pool API. This adds support to check for use of these pci
> > > functions and display a warning when it is the case.
> > > 
> > 
> > I guess Joe Perches did sent some comments for this one, did you address
> > them?
> 
> See the changelog of 00/20 (for v2). I have already integrated his
> comments :)

Not quite.  You need to add blank lines before and after
the new test you added.

I also wonder if you've in fact converted all of the
pci_pool struct and function uses why a new checkpatch
test is needed at all.

Also, it seems none of these patches have reached lkml.
Are you sending the patch series with MIME/html parts?  

> > Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
> > > Signed-off-by: Romain Perier <romain.perier@collabora.com>
> > > ---
> > >  scripts/checkpatch.pl | 9 ++++++++-
> > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > index baa3c7b..f2c775c 100755
> > > --- a/scripts/checkpatch.pl
> > > +++ b/scripts/checkpatch.pl
> > > @@ -6064,7 +6064,14 @@ sub process {
> > >  			WARN("USE_DEVICE_INITCALL",
> > >  			     "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
> > >  		}
> > > -
> > > +# check for old PCI api pci_pool_*(), use dma_pool_*() instead
> > > +		if ($line =~ /\bpci_pool(?:_(?:create|destroy|alloc|zalloc|free)|)\b/) {
> > > +			if (WARN("USE_DMA_POOL",
> > > +				 "please use the dma pool api or more appropriate function instead of the old pci pool api\n" . $herecurr) &&
> > > +			    $fix) {
> > > +				while ($fixed[$fixlinenr] =~ s/\bpci_pool(_(?:create|destroy|alloc|zalloc|free)|)\b/dma_pool$1/) {}
> > > +			}
> > > +		}
> > >  # check for various structs that are normally const (ops, kgdb, device_tree)
> > >  		if ($line !~ /\bconst\b/ &&
> > >  		    $line =~ /\bstruct\s+($const_structs)\b/) {
> > > -- 
> > > 2.9.3

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API
  2017-02-27 12:38           ` Joe Perches
@ 2017-02-27 12:52             ` Romain Perier
       [not found]               ` <ef1e7dae-d34a-7d30-c135-b4f2226853ed-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
  0 siblings, 1 reply; 26+ messages in thread
From: Romain Perier @ 2017-02-27 12:52 UTC (permalink / raw)
  To: Joe Perches, Peter Senna Tschudin
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

Hello,


Le 27/02/2017 à 13:38, Joe Perches a écrit :
> On Mon, 2017-02-27 at 13:26 +0100, Romain Perier wrote:
>> Hello,
>>
>>
>> Le 27/02/2017 à 12:22, Peter Senna Tschudin a écrit :
>>> On Sun, Feb 26, 2017 at 08:24:25PM +0100, Romain Perier wrote:
>>>> pci_pool_*() functions should be replaced by the corresponding functions
>>>> in the DMA pool API. This adds support to check for use of these pci
>>>> functions and display a warning when it is the case.
>>>>
>>> I guess Joe Perches did sent some comments for this one, did you address
>>> them?
>> See the changelog of 00/20 (for v2). I have already integrated his
>> comments :)
> Not quite.  You need to add blank lines before and after
> the new test you added.

Ok

>
> I also wonder if you've in fact converted all of the
> pci_pool struct and function uses why a new checkpatch
> test is needed at all.

That's just to avoid futures mistakes/uses.

>
> Also, it seems none of these patches have reached lkml.
> Are you sending the patch series with MIME/html parts?

Normally no. I use git send-email for all my patches.

Regards,
Romain

>
>>> Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>
>>>> Signed-off-by: Romain Perier <romain.perier@collabora.com>
>>>> ---
>>>>  scripts/checkpatch.pl | 9 ++++++++-
>>>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>>>> index baa3c7b..f2c775c 100755
>>>> --- a/scripts/checkpatch.pl
>>>> +++ b/scripts/checkpatch.pl
>>>> @@ -6064,7 +6064,14 @@ sub process {
>>>>  			WARN("USE_DEVICE_INITCALL",
>>>>  			     "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
>>>>  		}
>>>> -
>>>> +# check for old PCI api pci_pool_*(), use dma_pool_*() instead
>>>> +		if ($line =~ /\bpci_pool(?:_(?:create|destroy|alloc|zalloc|free)|)\b/) {
>>>> +			if (WARN("USE_DMA_POOL",
>>>> +				 "please use the dma pool api or more appropriate function instead of the old pci pool api\n" . $herecurr) &&
>>>> +			    $fix) {
>>>> +				while ($fixed[$fixlinenr] =~ s/\bpci_pool(_(?:create|destroy|alloc|zalloc|free)|)\b/dma_pool$1/) {}
>>>> +			}
>>>> +		}
>>>>  # check for various structs that are normally const (ops, kgdb, device_tree)
>>>>  		if ($line !~ /\bconst\b/ &&
>>>>  		    $line =~ /\bstruct\s+($const_structs)\b/) {
>>>> -- 
>>>> 2.9.3

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API
  2017-02-27 12:52             ` Romain Perier
@ 2017-02-27 15:52                   ` Joe Perches
  0 siblings, 0 replies; 26+ messages in thread
From: Joe Perches @ 2017-02-27 15:52 UTC (permalink / raw)
  To: Romain Perier, Peter Senna Tschudin
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w, David S. Miller,
	stas.yakovlev-Re5JQEeQqe8AvxtiuMwx3w, James E.J. Bottomley,
	Martin K. Petersen, Felipe Balbi, Greg Kroah-Hartman,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Peter Senna Tschudin

On Mon, 2017-02-27 at 13:52 +0100, Romain Perier wrote:

> > I also wonder if you've in fact converted all of the
> > pci_pool struct and function uses why a new checkpatch
> > test is needed at all.
> 
> That's just to avoid futures mistakes/uses.

When all instances and macro definitions are removed
the check is pointless as any newly submitted patch
will not compile.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API
@ 2017-02-27 15:52                   ` Joe Perches
  0 siblings, 0 replies; 26+ messages in thread
From: Joe Perches @ 2017-02-27 15:52 UTC (permalink / raw)
  To: Romain Perier, Peter Senna Tschudin
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Felipe Balbi,
	Greg Kroah-Hartman, linux-rdma, netdev, linux-usb, linux-scsi,
	linux-kernel, Peter Senna Tschudin

On Mon, 2017-02-27 at 13:52 +0100, Romain Perier wrote:

> > I also wonder if you've in fact converted all of the
> > pci_pool struct and function uses why a new checkpatch
> > test is needed at all.
> 
> That's just to avoid futures mistakes/uses.

When all instances and macro definitions are removed
the check is pointless as any newly submitted patch
will not compile.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 17/20] usb: gadget: pch_udc: Replace PCI pool old API
  2017-02-27 11:19   ` [PATCH v3 17/20] usb: gadget: pch_udc: " Peter Senna Tschudin
@ 2017-03-06 14:46     ` Felipe Balbi
  0 siblings, 0 replies; 26+ messages in thread
From: Felipe Balbi @ 2017-03-06 14:46 UTC (permalink / raw)
  To: Peter Senna Tschudin, Romain Perier
  Cc: Dan Williams, Doug Ledford, Sean Hefty, Hal Rosenstock,
	jeffrey.t.kirsher, David S. Miller, stas.yakovlev,
	James E.J. Bottomley, Martin K. Petersen, Greg Kroah-Hartman,
	linux-rdma, netdev, linux-usb, linux-scsi, linux-kernel,
	Peter Senna Tschudin

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

Peter Senna Tschudin <peter.senna@collabora.com> writes:
> On Sun, Feb 26, 2017 at 08:24:22PM +0100, Romain Perier wrote:
>> The PCI pool API is deprecated. This commits replaces the PCI pool old
>> API by the appropriated function with the DMA pool API.
>> 
> Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com>

Fine by me:

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2017-03-06 14:46 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170226192425.13098-1-romain.perier@collabora.com>
     [not found] ` <20170226192425.13098-7-romain.perier@collabora.com>
2017-02-27 11:08   ` [PATCH v3 06/20] mlx5: Replace PCI pool old API Peter Senna Tschudin
     [not found] ` <20170226192425.13098-8-romain.perier@collabora.com>
     [not found]   ` <20170226192425.13098-8-romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2017-02-27 11:09     ` [PATCH v3 07/20] wireless: ipw2200: " Peter Senna Tschudin
2017-02-27 11:09       ` Peter Senna Tschudin
     [not found] ` <20170226192425.13098-10-romain.perier@collabora.com>
     [not found]   ` <20170226192425.13098-10-romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2017-02-27 11:11     ` [PATCH v3 09/20] scsi: csiostor: " Peter Senna Tschudin
2017-02-27 11:11       ` Peter Senna Tschudin
     [not found] ` <20170226192425.13098-11-romain.perier@collabora.com>
     [not found]   ` <20170226192425.13098-11-romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2017-02-27 11:13     ` [PATCH v3 10/20] scsi: lpfc: " Peter Senna Tschudin
2017-02-27 11:13       ` Peter Senna Tschudin
     [not found] ` <20170226192425.13098-12-romain.perier@collabora.com>
2017-02-27 11:16   ` [PATCH v3 11/20] scsi: megaraid: " Peter Senna Tschudin
     [not found] ` <20170226192425.13098-13-romain.perier@collabora.com>
     [not found]   ` <20170226192425.13098-13-romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2017-02-27 11:18     ` [PATCH v3 12/20] scsi: mpt3sas: " Peter Senna Tschudin
2017-02-27 11:18       ` Peter Senna Tschudin
     [not found] ` <20170226192425.13098-14-romain.perier@collabora.com>
2017-02-27 11:18   ` [PATCH v3 13/20] scsi: mvsas: " Peter Senna Tschudin
     [not found] ` <20170226192425.13098-18-romain.perier@collabora.com>
2017-02-27 11:19   ` [PATCH v3 17/20] usb: gadget: pch_udc: " Peter Senna Tschudin
2017-03-06 14:46     ` Felipe Balbi
     [not found] ` <20170226192425.13098-19-romain.perier@collabora.com>
2017-02-27 11:20   ` [PATCH v3 18/20] usb: host: Remove remaining pci_pool in comments Peter Senna Tschudin
     [not found] ` <20170226192425.13098-20-romain.perier@collabora.com>
2017-02-27 11:20   ` [PATCH v3 19/20] PCI: Remove PCI pool macro functions Peter Senna Tschudin
     [not found] ` <20170226192425.13098-21-romain.perier@collabora.com>
     [not found]   ` <20170226192425.13098-21-romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2017-02-27 11:22     ` [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API Peter Senna Tschudin
2017-02-27 11:22       ` Peter Senna Tschudin
2017-02-27 11:53       ` Joe Perches
     [not found]       ` <20170227112233.GK26544-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2017-02-27 12:26         ` Romain Perier
2017-02-27 12:26           ` Romain Perier
2017-02-27 12:38           ` Joe Perches
2017-02-27 12:52             ` Romain Perier
     [not found]               ` <ef1e7dae-d34a-7d30-c135-b4f2226853ed-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2017-02-27 15:52                 ` Joe Perches
2017-02-27 15:52                   ` Joe Perches
     [not found] ` <20170226192425.13098-1-romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2017-02-27 11:23   ` [PATCH v3 00/20] Replace PCI pool by DMA " Peter Senna Tschudin
2017-02-27 11:23     ` Peter Senna Tschudin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.