Re: [PATCH v5 04/19] net: e100: Replace PCI pool old API

2017-03-08 Thread Peter Senna Tschudin
On Wed, Mar 08, 2017 at 02:40:25PM -0800, Jeff Kirsher wrote:
> On Wed, 2017-03-08 at 17:19 +0100, Romain Perier wrote:
> > The PCI pool API is deprecated. This commit replaces the PCI pool old
> > API by the appropriate function with the DMA pool API.
> > 
> > Signed-off-by: Romain Perier <romain.per...@collabora.com>
> > Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
> > Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> > ---
> >  drivers/net/ethernet/intel/e100.c | 12 ++--
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> Acked-by: Jeff Kirsher <jeffrey.t.kirs...@intel.com>
> 
> My only concern is:
> - what hardware did this get tested with?  Since this affects all e100
> parts, it would be hard to believe that all the affected hardware was
> used in testing.

This was tested by compilation only(See
https://lkml.org/lkml/2017/2/8/661). However this series removes macro
definitions of the old pci_pool interface and replace call sites by what
the macra was calling.

Here are the macros that this series removes from include/pci.h:

#define pci_pool dma_pool
#define pci_pool_create(name, pdev, size, align, allocation) \
dma_pool_create(name, >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, add

So this should not affect run time.


Re: [PATCH v3 12/20] scsi: mpt3sas: Replace PCI pool old API

2017-02-27 Thread 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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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 = >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(&

Re: [PATCH v3 17/20] usb: gadget: pch_udc: Replace PCI pool old API

2017-02-27 Thread 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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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,
>   _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;
>   /* 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,
> >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", >pdev->dev,
>   sizeof(struct pch_udc_data_dma_desc), 0, 0);
>   if (!dev->data_requests) {
>   dev_err(>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", >pdev->dev,
>   sizeof(struct pch_udc_stp_dma_desc), 0, 0);
>   if (!dev->stp_requests) {
>   dev_err(>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_r

Re: [PATCH v3 13/20] scsi: mvsas: Replace PCI pool old API

2017-02-27 Thread 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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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, >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, >buf_dma);
> + slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, >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(>entry);
> -- 
> 2.9.3
> 


Re: [PATCH v3 11/20] scsi: megaraid: Replace PCI pool old API

2017-02-27 Thread 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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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",
> + >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,
>   _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",
> + >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,
>   _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",
> + >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,
>   _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->s

Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API

2017-02-27 Thread Peter Senna Tschudin
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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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
> 


Re: [PATCH v3 19/20] PCI: Remove PCI pool macro functions

2017-02-27 Thread 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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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 
>  #include 
>  
> -#define  pci_pool dma_pool
> -#define pci_pool_create(name, pdev, size, align, allocation) \
> - dma_pool_create(name, >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
> 


Re: [PATCH v3 00/20] Replace PCI pool by DMA pool API

2017-02-27 Thread 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
> 


Re: [PATCH v3 07/20] wireless: ipw2200: Replace PCI pool old API

2017-02-27 Thread 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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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", >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,
>[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
> 


Re: [PATCH v3 09/20] scsi: csiostor: Replace PCI pool old API

2017-02-27 Thread 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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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",
> + >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 = >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,
>   _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 = >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 = >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
> 


Re: [PATCH v3 18/20] usb: host: Remove remaining pci_pool in comments

2017-02-27 Thread 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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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
> 


Re: [PATCH v3 06/20] mlx5: Replace PCI pool old API

2017-02-27 Thread 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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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,
>  >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", >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
> 


Re: [PATCH v3 10/20] scsi: lpfc: Replace PCI pool old API

2017-02-27 Thread 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.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@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, >lpfc_scsi_buf_list_put,
>list) {
>   list_del(>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, >lpfc_scsi_buf_list_get,
>list) {
>   list_del(>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,
>>lpfc_nvme_buf_list_put, list) {
>   list_del(_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,
>>lpfc_nvme_buf_list_get, list) {
>   list_del(_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(_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(_sgl_list, lpfc_ncmd,
>  

Re: [RFC v2 11/20] scsi: megaraid: Replace PCI pool old API

2017-02-18 Thread Peter Senna Tschudin
On Sat, Feb 18, 2017 at 09:35:47AM +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.

Did not apply on linux-next-20170217


> 
> Signed-off-by: Romain Perier 
> ---
>  drivers/scsi/megaraid/megaraid_mbox.c   | 30 -
>  drivers/scsi/megaraid/megaraid_mm.c | 29 
>  drivers/scsi/megaraid/megaraid_sas_base.c   | 25 +++---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 51 
> +++--
>  4 files changed, 70 insertions(+), 65 deletions(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_mbox.c 
> b/drivers/scsi/megaraid/megaraid_mbox.c
> index f0987f2..6d0bd3a 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",
> + >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,
>   _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",
> + >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,
>   _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",
> + >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,
>   _pci_blk[i].dma_addr);
> @@ -1249,29 +1249,29 @@ 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, 

Re: [RFC v2 00/20] Replace PCI pool by DMA pool API

2017-02-18 Thread Peter Senna Tschudin
On Sat, Feb 18, 2017 at 09:35:36AM +0100, Romain Perier wrote:

Tested all patches by compilation and checkpatch. All of them compile
fine, but patches 11 and 12 need some fixes. You can resend as
PATCH instead of RFC.

> 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 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
> 
> 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  | 10 ++--
>  drivers/scsi/lpfc/lpfc_init.c |  6 +--
>  drivers/scsi/lpfc/lpfc_mem.c  | 73 
> +--
>  drivers/scsi/lpfc/lpfc_scsi.c | 12 ++---
>  drivers/scsi/megaraid/megaraid_mbox.c | 30 +--
>  drivers/scsi/megaraid/megaraid_mm.c   | 29 ++-
>  drivers/scsi/megaraid/megaraid_sas_base.c | 25 -
>  drivers/scsi/megaraid/megaraid_sas_fusion.c   | 51 ++-
>  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 +++-
>  41 files changed, 284 insertions(+), 287 deletions(-)
> 
> -- 
> 2.9.3
> 


Re: [RFC v2 12/20] scsi: mpt3sas: Replace PCI pool old API

2017-02-18 Thread Peter Senna Tschudin
On Sat, Feb 18, 2017 at 09:35:48AM +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.

Please run checkpatch, fix the style issue and resend.

> 
> Signed-off-by: Romain Perier 
> ---
>  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 a3fe1fb..3c2206d 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -3210,9 +3210,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));
> @@ -3220,9 +3219,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));
> @@ -3230,10 +3228,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));
> @@ -3244,7 +3241,7 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>   do {
>   rps = >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);
> @@ -3256,8 +3253,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);
>   }
>  
> @@ -3278,12 +3274,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;
>   }
> @@ -3458,23 +3453,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",
> + >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 

Re: [RFC v2 11/20] scsi: megaraid: Replace PCI pool old API

2017-02-18 Thread Peter Senna Tschudin
On Sat, Feb 18, 2017 at 09:35:47AM +0100, Romain Perier wrote:

Hi Romain,

Checkpatch gives some warnings you can fix related to NULL tests before
dma_pool_destroy(), and you changed indentation style in some of your
changes. Some times it is important to keep consistency within a file
even if the style is not the default. Please fix and resend.


> The PCI pool API is deprecated. This commits replaces the PCI pool old
> API by the appropriated function with the DMA pool API.
> 
> Signed-off-by: Romain Perier 
> ---
>  drivers/scsi/megaraid/megaraid_mbox.c   | 30 -
>  drivers/scsi/megaraid/megaraid_mm.c | 29 
>  drivers/scsi/megaraid/megaraid_sas_base.c   | 25 +++---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 51 
> +++--
>  4 files changed, 70 insertions(+), 65 deletions(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_mbox.c 
> b/drivers/scsi/megaraid/megaraid_mbox.c
> index f0987f2..6d0bd3a 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",
> + >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,
>   _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",
> + >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,
>   _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",
> + >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,
>   _pci_blk[i].dma_addr);
> @@ -1249,29 +1249,29 @@ 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 = 

Re: [RFC v2 01/20] block: DAC960: Replace PCI pool old API

2017-02-18 Thread Peter Senna Tschudin
On Sat, Feb 18, 2017 at 09:35:37AM +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.
> 

no new errors added, tested by compilation only.

> Signed-off-by: Romain Perier <romain.per...@collabora.com>
> Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
> Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> ---
>  drivers/block/DAC960.c | 36 ++--
>  drivers/block/DAC960.h |  4 ++--
>  2 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
> index 26a51be..2b221cc 100644
> --- a/drivers/block/DAC960.c
> +++ b/drivers/block/DAC960.c
> @@ -268,17 +268,17 @@ static bool 
> DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
>void *AllocationPointer = NULL;
>void *ScatterGatherCPU = NULL;
>dma_addr_t ScatterGatherDMA;
> -  struct pci_pool *ScatterGatherPool;
> +  struct dma_pool *ScatterGatherPool;
>void *RequestSenseCPU = NULL;
>dma_addr_t RequestSenseDMA;
> -  struct pci_pool *RequestSensePool = NULL;
> +  struct dma_pool *RequestSensePool = NULL;
>  
>if (Controller->FirmwareType == DAC960_V1_Controller)
>  {
>CommandAllocationLength = offsetof(DAC960_Command_T, V1.EndMarker);
>CommandAllocationGroupSize = DAC960_V1_CommandAllocationGroupSize;
> -  ScatterGatherPool = pci_pool_create("DAC960_V1_ScatterGather",
> - Controller->PCIDevice,
> +  ScatterGatherPool = dma_pool_create("DAC960_V1_ScatterGather",
> + >PCIDevice->dev,
>   DAC960_V1_ScatterGatherLimit * sizeof(DAC960_V1_ScatterGatherSegment_T),
>   sizeof(DAC960_V1_ScatterGatherSegment_T), 0);
>if (ScatterGatherPool == NULL)
> @@ -290,18 +290,18 @@ static bool 
> DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
>  {
>CommandAllocationLength = offsetof(DAC960_Command_T, V2.EndMarker);
>CommandAllocationGroupSize = DAC960_V2_CommandAllocationGroupSize;
> -  ScatterGatherPool = pci_pool_create("DAC960_V2_ScatterGather",
> - Controller->PCIDevice,
> +  ScatterGatherPool = dma_pool_create("DAC960_V2_ScatterGather",
> + >PCIDevice->dev,
>   DAC960_V2_ScatterGatherLimit * sizeof(DAC960_V2_ScatterGatherSegment_T),
>   sizeof(DAC960_V2_ScatterGatherSegment_T), 0);
>if (ScatterGatherPool == NULL)
>   return DAC960_Failure(Controller,
>   "AUXILIARY STRUCTURE CREATION (SG)");
> -  RequestSensePool = pci_pool_create("DAC960_V2_RequestSense",
> - Controller->PCIDevice, sizeof(DAC960_SCSI_RequestSense_T),
> +  RequestSensePool = dma_pool_create("DAC960_V2_RequestSense",
> + >PCIDevice->dev, sizeof(DAC960_SCSI_RequestSense_T),
>   sizeof(int), 0);
>if (RequestSensePool == NULL) {
> - pci_pool_destroy(ScatterGatherPool);
> + dma_pool_destroy(ScatterGatherPool);
>   return DAC960_Failure(Controller,
>   "AUXILIARY STRUCTURE CREATION (SG)");
>}
> @@ -335,16 +335,16 @@ static bool 
> DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
>Command->Next = Controller->FreeCommands;
>Controller->FreeCommands = Command;
>Controller->Commands[CommandIdentifier-1] = Command;
> -  ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, GFP_ATOMIC,
> +  ScatterGatherCPU = dma_pool_alloc(ScatterGatherPool, GFP_ATOMIC,
>   );
>if (ScatterGatherCPU == NULL)
> return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION");
>  
>if (RequestSensePool != NULL) {
> -   RequestSenseCPU = pci_pool_alloc(RequestSensePool, GFP_ATOMIC,
> +   RequestSenseCPU = dma_pool_alloc(RequestSensePool, GFP_ATOMIC,
>   );
> if (RequestSenseCPU == NULL) {
> -pci_pool_free(ScatterGatherPool, ScatterGatherCPU,
> +dma_pool_free(ScatterGatherPool, ScatterGatherCPU,
>  ScatterGatherDMA);
>   return DAC960_Failure(Controller,
>   "AUXILIARY STRUCTURE CREATION");
> @@ -379,8 +379,8 @@ static bool 
> DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
>  static void DAC960_DestroyAuxiliaryStructures(DAC960_Controller_T 
> *Controller)
>  {
>int i;
>

Re: [RFC 11/19] scsi: megaraid: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:49PM +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.
> 
> Signed-off-by: Romain Perier 
> ---
>  drivers/scsi/megaraid/megaraid_mbox.c   | 30 ++--
>  drivers/scsi/megaraid/megaraid_mm.c | 28 +-
>  drivers/scsi/megaraid/megaraid_sas_base.c   | 24 
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 44 
> ++---
>  4 files changed, 63 insertions(+), 63 deletions(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_mbox.c 
> b/drivers/scsi/megaraid/megaraid_mbox.c
> index f0987f2..6d0bd3a 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",
> + >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,
>   _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",
> + >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,
>   _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",
> + >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,
>   _pci_blk[i].dma_addr);
> @@ -1249,29 +1249,29 @@ 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)
dma_pool_destroy(NULL) is safe and this check is probably not required

> - 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,
>   

Re: [RFC 10/19] scsi: lpfc: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:48PM +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.
> 
> Signed-off-by: Romain Perier 
> ---
>  drivers/scsi/lpfc/lpfc.h  | 10 +++
>  drivers/scsi/lpfc/lpfc_init.c |  6 ++---
>  drivers/scsi/lpfc/lpfc_mem.c  | 62 
> +--
>  drivers/scsi/lpfc/lpfc_scsi.c | 12 -
>  4 files changed, 45 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
> index 6593b07..c391352 100644
> --- a/drivers/scsi/lpfc/lpfc.h
> +++ b/drivers/scsi/lpfc/lpfc.h
> @@ -862,11 +862,11 @@ struct lpfc_hba {
>   spinlock_t hbalock;
>  
>   /* pci_mem_pools */
> - struct pci_pool *lpfc_scsi_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 dma_pool *lpfc_scsi_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 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 64717c1..c38bc0b 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -3108,7 +3108,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
>   list_for_each_entry_safe(sb, sb_next, >lpfc_scsi_buf_list_put,
>list) {
>   list_del(>list);
> - pci_pool_free(phba->lpfc_scsi_dma_buf_pool, sb->data,
> + dma_pool_free(phba->lpfc_scsi_dma_buf_pool, sb->data,
> sb->dma_handle);
>   kfree(sb);
>   phba->total_scsi_bufs--;
> @@ -3119,7 +3119,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
>   list_for_each_entry_safe(sb, sb_next, >lpfc_scsi_buf_list_get,
>list) {
>   list_del(>list);
> - pci_pool_free(phba->lpfc_scsi_dma_buf_pool, sb->data,
> + dma_pool_free(phba->lpfc_scsi_dma_buf_pool, sb->data,
> sb->dma_handle);
>   kfree(sb);
>   phba->total_scsi_bufs--;
> @@ -3283,7 +3283,7 @@ lpfc_sli4_xri_sgl_update(struct lpfc_hba *phba)
>   list_remove_head(_sgl_list, psb,
>struct lpfc_scsi_buf, list);
>   if (psb) {
> - pci_pool_free(phba->lpfc_scsi_dma_buf_pool,
> + dma_pool_free(phba->lpfc_scsi_dma_buf_pool,
> psb->data, psb->dma_handle);
>   kfree(psb);
>   }
> diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
> index 3fa6533..c87f64c 100644
> --- a/drivers/scsi/lpfc/lpfc_mem.c
> +++ b/drivers/scsi/lpfc/lpfc_mem.c
> @@ -91,22 +91,22 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
>   i = SLI4_PAGE_SIZE;
>  
>   phba->lpfc_scsi_dma_buf_pool =
> - pci_pool_create("lpfc_scsi_dma_buf_pool",
> - phba->pcidev,
> + dma_pool_create("lpfc_scsi_dma_buf_pool",
> + >pcidev->dev,
>   phba->cfg_sg_dma_buf_size,
>   i,
>   0);
>   } else {
>   phba->lpfc_scsi_dma_buf_pool =
> - pci_pool_create("lpfc_scsi_dma_buf_pool",
> - phba->pcidev, phba->cfg_sg_dma_buf_size,
> + dma_pool_create("lpfc_scsi_dma_buf_pool",
> + >pcidev->dev, phba->cfg_sg_dma_buf_size,
>   align, 0);
>   }
>  
>   if (!phba->lpfc_scsi_dma_buf_pool)
>   goto fail;
>  
> - phba->lpfc_mbuf_pool = pci_pool_create("lpfc_mbuf_pool", phba->pcidev,
> + phba->lpfc_mbuf_pool = dma_pool_create("lpfc_mbuf_pool", 
> >pcidev->dev,
Introduces line over 80 characters warning. Please fix and resubmit.

>   LPFC_BPL_SIZE,
>   align, 0);
>   if (!phba->lpfc_mbuf_pool)
> @@ -120,7 +120,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,
> +   

Re: [RFC 19/19] checkpatch: warn for use of old PCI pool API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:57PM +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.

Don't know if relevant, but did not catch the struct. Other than that
works fine.

> 
> Signed-off-by: Romain Perier 
> ---
>  scripts/checkpatch.pl | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 8e96af5..026920e 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6058,6 +6058,11 @@ 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_.+\(/) {
> + WARN("USE_PCI_POOL",
> +  "please use the dma pool api or more appropriate 
> function instead of the old pci pool api\n" . $herecurr);
> + }
>  
>  # check for various structs that are normally const (ops, kgdb, device_tree)
>   if ($line !~ /\bconst\b/ &&
> -- 
> 2.9.3
> 


Re: [RFC 00/19] Replace PCI pool by DMA pool API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:38PM +0100, Romain Perier wrote:
Hi Romain,

Nice set of patches! Thank you.

I sent a few comments, but basically you missed to run checkpatch.pl on
your patches. Also you can take the chance to fix some white space
issues that are on the lines you are changing like space before , and
trailing white space.

But maybe the part that I missed more is that you can also adrress the
fact that dma_pool_destroy(NULL) is safe and that checking for NULL may
not be needed. So I would fix this NULL test at least on all files that
you are changing, not only around your changes, but on the entire file.

Peter
> 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.
> 
> Romain Perier (19):
>   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
>   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 | 10 ++---
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c  | 12 ++---
>  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 |  4 +-
>  drivers/scsi/csiostor/csio_scsi.c |  6 +--
>  drivers/scsi/lpfc/lpfc.h  | 10 ++---
>  drivers/scsi/lpfc/lpfc_init.c |  6 +--
>  drivers/scsi/lpfc/lpfc_mem.c  | 62 +-
>  drivers/scsi/lpfc/lpfc_scsi.c | 12 ++---
>  drivers/scsi/megaraid/megaraid_mbox.c | 30 ++---
>  drivers/scsi/megaraid/megaraid_mm.c   | 28 ++--
>  drivers/scsi/megaraid/megaraid_sas_base.c | 24 +-
>  drivers/scsi/megaraid/megaraid_sas_fusion.c   | 44 +-
>  drivers/scsi/mpt3sas/mpt3sas_base.c   | 64 
> +--
>  drivers/scsi/mvsas/mv_init.c  |  4 +-
>  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  | 28 ++--
>  include/linux/mlx5/driver.h   |  2 +-
>  include/linux/pci.h   |  9 
>  scripts/checkpatch.pl |  5 +++
>  38 files changed, 257 insertions(+), 261 deletions(-)
> 
> -- 
> 2.9.3
> 


Re: [RFC 04/19] net: e100: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:42PM +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.

Tested by compilation only.

Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@collabora.com>
> ---
>  drivers/net/ethernet/intel/e100.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/e100.c 
> b/drivers/net/ethernet/intel/e100.c
> index 2b7323d..d1002c2 100644
> --- a/drivers/net/ethernet/intel/e100.c
> +++ b/drivers/net/ethernet/intel/e100.c
> @@ -607,7 +607,7 @@ struct nic {
>   struct mem *mem;
>   dma_addr_t dma_addr;
>  
> - struct pci_pool *cbs_pool;
> + struct dma_pool *cbs_pool;
>   dma_addr_t cbs_dma_addr;
>   u8 adaptive_ifs;
>   u8 tx_threshold;
> @@ -1892,7 +1892,7 @@ static void e100_clean_cbs(struct nic *nic)
>   nic->cb_to_clean = nic->cb_to_clean->next;
>   nic->cbs_avail++;
>   }
> - pci_pool_free(nic->cbs_pool, nic->cbs, nic->cbs_dma_addr);
> + dma_pool_free(nic->cbs_pool, nic->cbs, nic->cbs_dma_addr);
>   nic->cbs = NULL;
>   nic->cbs_avail = 0;
>   }
> @@ -1910,7 +1910,7 @@ static int e100_alloc_cbs(struct nic *nic)
>   nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL;
>   nic->cbs_avail = 0;
>  
> - nic->cbs = pci_pool_alloc(nic->cbs_pool, GFP_KERNEL,
> + nic->cbs = dma_pool_alloc(nic->cbs_pool, GFP_KERNEL,
> >cbs_dma_addr);
>   if (!nic->cbs)
>   return -ENOMEM;
> @@ -2958,8 +2958,8 @@ static int e100_probe(struct pci_dev *pdev, const 
> struct pci_device_id *ent)
>   netif_err(nic, probe, nic->netdev, "Cannot register net device, 
> aborting\n");
>   goto err_out_free;
>   }
> - nic->cbs_pool = pci_pool_create(netdev->name,
> -nic->pdev,
> + nic->cbs_pool = dma_pool_create(netdev->name,
> +>pdev->dev,
>  nic->params.cbs.max * sizeof(struct cb),
>  sizeof(u32),
>  0);
> @@ -2999,7 +2999,7 @@ static void e100_remove(struct pci_dev *pdev)
>   unregister_netdev(netdev);
>   e100_free(nic);
>   pci_iounmap(pdev, nic->csr);
> - pci_pool_destroy(nic->cbs_pool);
> + dma_pool_destroy(nic->cbs_pool);
>   free_netdev(netdev);
>   pci_release_regions(pdev);
>   pci_disable_device(pdev);
> -- 
> 2.9.3
> 


Re: [RFC 05/19] mlx4: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:43PM +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.

Tested by compilation only.

Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@collabora.com>
> ---
>  drivers/net/ethernet/mellanox/mlx4/cmd.c  | 10 +-
>  drivers/net/ethernet/mellanox/mlx4/mlx4.h |  2 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c 
> b/drivers/net/ethernet/mellanox/mlx4/cmd.c
> index a49072b4..d400cde 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
> @@ -2515,8 +2515,8 @@ int mlx4_cmd_init(struct mlx4_dev *dev)
>   }
>  
>   if (!priv->cmd.pool) {
> - priv->cmd.pool = pci_pool_create("mlx4_cmd",
> -  dev->persist->pdev,
> + priv->cmd.pool = dma_pool_create("mlx4_cmd",
> +  >persist->pdev->dev,
>MLX4_MAILBOX_SIZE,
>MLX4_MAILBOX_SIZE, 0);
>   if (!priv->cmd.pool)
> @@ -2587,7 +2587,7 @@ void mlx4_cmd_cleanup(struct mlx4_dev *dev, int 
> cleanup_mask)
>   struct mlx4_priv *priv = mlx4_priv(dev);
>  
>   if (priv->cmd.pool && (cleanup_mask & MLX4_CMD_CLEANUP_POOL)) {
> - pci_pool_destroy(priv->cmd.pool);
> + dma_pool_destroy(priv->cmd.pool);
>   priv->cmd.pool = NULL;
>   }
>  
> @@ -2679,7 +2679,7 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct 
> mlx4_dev *dev)
>   if (!mailbox)
>   return ERR_PTR(-ENOMEM);
>  
> - mailbox->buf = pci_pool_zalloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
> + mailbox->buf = dma_pool_zalloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
>  >dma);
>   if (!mailbox->buf) {
>   kfree(mailbox);
> @@ -2696,7 +2696,7 @@ void mlx4_free_cmd_mailbox(struct mlx4_dev *dev,
>   if (!mailbox)
>   return;
>  
> - pci_pool_free(mlx4_priv(dev)->cmd.pool, mailbox->buf, mailbox->dma);
> + dma_pool_free(mlx4_priv(dev)->cmd.pool, mailbox->buf, mailbox->dma);
>   kfree(mailbox);
>  }
>  EXPORT_SYMBOL_GPL(mlx4_free_cmd_mailbox);
> diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h 
> b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
> index b4f1bc5..69c8764 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
> +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
> @@ -628,7 +628,7 @@ struct mlx4_mgm {
>  };
>  
>  struct mlx4_cmd {
> - struct pci_pool*pool;
> + struct dma_pool*pool;
>   void __iomem   *hcr;
>   struct mutexslave_cmd_mutex;
>   struct semaphorepoll_sem;
> -- 
> 2.9.3
> 


Re: [RFC 18/19] PCI: Remove PCI pool macro functions

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:56PM +0100, Romain Perier wrote:
> Now that all the drivers use dma pool API, we can remove the macro
> functions for PCI pool.

Good news: make allyesconfig;make succeed after the changes until this
point, but:

$ grep -R pci_pool
...
drivers/usb/gadget/udc/pch_udc.c: * -ENOMEM:pci_pool_alloc
invocation fails
drivers/usb/host/oxu210hp-hcd.c: * pci_pool consistent memory
always uses segment zero.
drivers/usb/host/fotg210-hcd.c:  * pci_pool consistent memory always
uses segment zero.
drivers/usb/host/ehci-hcd.c: * pci_pool consistent memory always
uses segment zero.
drivers/scsi/lpfc/lpfc_mem.c: * Allocates from generic pci_pool_alloc
function first and if that fails and
drivers/scsi/csiostor/csio_init.c:  hw->scsi_pci_pool =
dma_pool_create("csio_scsi_pci_pool", >pdev->dev,
drivers/scsi/csiostor/csio_init.c:  if (!hw->scsi_pci_pool)
drivers/scsi/csiostor/csio_init.c:
dma_pool_destroy(hw->scsi_pci_pool);
drivers/scsi/csiostor/csio_init.c:  hw->scsi_pci_pool = NULL;
drivers/scsi/csiostor/csio_scsi.c:  dma_buf->vaddr =
dma_pool_alloc(hw->scsi_pci_pool, GFP_KERNEL,
drivers/scsi/csiostor/csio_scsi.c:
dma_pool_free(hw->scsi_pci_pool, dma_buf->vaddr,
drivers/scsi/csiostor/csio_scsi.c:
dma_pool_free(scm->hw->scsi_pci_pool, dma_buf->vaddr,
drivers/scsi/csiostor/csio_hw.h:struct dma_pool
*scsi_pci_pool; /* PCI pool for SCSI */

this can be updated or removed, needs to check:
scripts/coccinelle/api/alloc/pool_zalloc-simple.cocci

> 
> Signed-off-by: Romain Perier 
> ---
>  include/linux/pci.h | 9 -
>  1 file changed, 9 deletions(-)
> 
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 11d15d4..c3a93e4 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1284,15 +1284,6 @@ int pci_set_vga_state(struct pci_dev *pdev, bool 
> decode,
>  #include 
>  #include 
>  
> -#define  pci_pool dma_pool
> -#define pci_pool_create(name, pdev, size, align, allocation) \
> - dma_pool_create(name, >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
> 


Re: [RFC 15/19] usb: gadget: amd5536udc: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:53PM +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.
> 
Tested by compilation only.

Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@collabora.com>
> ---
>  drivers/usb/gadget/udc/amd5536udc.c | 8 
>  drivers/usb/gadget/udc/amd5536udc.h | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/amd5536udc.c 
> b/drivers/usb/gadget/udc/amd5536udc.c
> index ea03ca7..270876b 100644
> --- a/drivers/usb/gadget/udc/amd5536udc.c
> +++ b/drivers/usb/gadget/udc/amd5536udc.c
> @@ -583,7 +583,7 @@ udc_alloc_request(struct usb_ep *usbep, gfp_t gfp)
>  
>   if (ep->dma) {
>   /* 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,
>   >td_phys);
>   if (!dma_desc) {
>   kfree(req);
> @@ -622,7 +622,7 @@ static int udc_free_dma_chain(struct udc *dev, struct 
> udc_request *req)
>   td = phys_to_virt(td_last->next);
>  
>   for (i = 1; i < req->chain_len; i++) {
> - pci_pool_free(dev->data_requests, td,
> + dma_pool_free(dev->data_requests, td,
> (dma_addr_t)td_last->next);
>   td_last = td;
>   td = phys_to_virt(td_last->next);
> @@ -652,7 +652,7 @@ udc_free_request(struct usb_ep *usbep, struct usb_request 
> *usbreq)
>   if (req->chain_len > 1)
>   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_phys);
>   }
>   kfree(req);
> @@ -847,7 +847,7 @@ static int udc_create_dma_chain(
>   for (i = buf_len; i < bytes; i += buf_len) {
>   /* create or determine next desc. */
>   if (create_new_chain) {
> - td = pci_pool_alloc(ep->dev->data_requests,
> + td = dma_pool_alloc(ep->dev->data_requests,
>   gfp_flags, _addr);
>   if (!td)
>   return -ENOMEM;
> diff --git a/drivers/usb/gadget/udc/amd5536udc.h 
> b/drivers/usb/gadget/udc/amd5536udc.h
> index 4638d70..85d5aa5 100644
> --- a/drivers/usb/gadget/udc/amd5536udc.h
> +++ b/drivers/usb/gadget/udc/amd5536udc.h
> @@ -545,8 +545,8 @@ struct udc {
>   u32 __iomem *txfifo;
>  
>   /* DMA desc pools */
> - struct pci_pool *data_requests;
> - struct pci_pool *stp_requests;
> + struct dma_pool *data_requests;
> + struct dma_pool *stp_requests;
>  
>   /* device data */
>   unsigned long   phys_addr;
> -- 
> 2.9.3
> 


Re: [RFC 14/19] scsi: pmcraid: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:52PM +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.
> 
Tested by compilation only.

Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@collabora.com>
> ---
>  drivers/scsi/pmcraid.c | 10 +-
>  drivers/scsi/pmcraid.h |  2 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
> index 49e70a3..0f893c4 100644
> --- a/drivers/scsi/pmcraid.c
> +++ b/drivers/scsi/pmcraid.c
> @@ -4699,13 +4699,13 @@ pmcraid_release_control_blocks(
>   return;
>  
>   for (i = 0; i < max_index; i++) {
> - pci_pool_free(pinstance->control_pool,
> + dma_pool_free(pinstance->control_pool,
> pinstance->cmd_list[i]->ioa_cb,
> pinstance->cmd_list[i]->ioa_cb_bus_addr);
>   pinstance->cmd_list[i]->ioa_cb = NULL;
>   pinstance->cmd_list[i]->ioa_cb_bus_addr = 0;
>   }
> - pci_pool_destroy(pinstance->control_pool);
> + dma_pool_destroy(pinstance->control_pool);
>   pinstance->control_pool = NULL;
>  }
>  
> @@ -4762,8 +4762,8 @@ static int pmcraid_allocate_control_blocks(struct 
> pmcraid_instance *pinstance)
>   pinstance->host->unique_id);
>  
>   pinstance->control_pool =
> - pci_pool_create(pinstance->ctl_pool_name,
> - pinstance->pdev,
> + dma_pool_create(pinstance->ctl_pool_name,
> + >pdev->dev,
>   sizeof(struct pmcraid_control_block),
>   PMCRAID_IOARCB_ALIGNMENT, 0);
>  
> @@ -4772,7 +4772,7 @@ static int pmcraid_allocate_control_blocks(struct 
> pmcraid_instance *pinstance)
>  
>   for (i = 0; i < PMCRAID_MAX_CMD; i++) {
>   pinstance->cmd_list[i]->ioa_cb =
> - pci_pool_alloc(
> + dma_pool_alloc(
>   pinstance->control_pool,
>   GFP_KERNEL,
>   &(pinstance->cmd_list[i]->ioa_cb_bus_addr));
> diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h
> index 568b18a..acf5a7b 100644
> --- a/drivers/scsi/pmcraid.h
> +++ b/drivers/scsi/pmcraid.h
> @@ -755,7 +755,7 @@ struct pmcraid_instance {
>  
>   /* structures related to command blocks */
>   struct kmem_cache *cmd_cachep;  /* cache for cmd blocks */
> - struct pci_pool *control_pool;  /* pool for control blocks */
> + struct dma_pool *control_pool;  /* pool for control blocks */
>   char   cmd_pool_name[64];   /* name of cmd cache */
>   char   ctl_pool_name[64];   /* name of control cache */
>  
> -- 
> 2.9.3
> 


Re: [RFC 17/19] usb: gadget: pch_udc: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:55PM +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.
> 
> Signed-off-by: Romain Perier 
> ---
>  drivers/usb/gadget/udc/pch_udc.c | 28 ++--
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/pch_udc.c 
> b/drivers/usb/gadget/udc/pch_udc.c
> index a97da64..37045fc 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;
>   }
> @@ -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,
>   _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;
>   /* 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,
> >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", >pdev->dev,
>   sizeof(struct pch_udc_data_dma_desc), 0, 0);
>   if (!dev->data_requests) {
>   dev_err(>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", >pdev->dev,
>   sizeof(struct pch_udc_stp_dma_desc), 0, 0);
>   if (!dev->stp_requests) {
>   dev_err(>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,
>   >ep[UDC_EP0OUT_IDX].td_stp_phys);
>   if (!td_stp) {
>   dev_err(>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,
>   >ep[UDC_EP0OUT_IDX].td_data_phys);
>   if (!td_data) {
>   dev_err(>pdev->dev,
> @@ -3022,21 +3022,21 @@ static void pch_udc_remove(struct pci_dev *pdev)
>   "%s: gadget driver still bound!!!\n", __func__);
>   /* dma pool cleanup */
>   if (dev->data_requests)
dma_pool_destroy(NULL) is safe and this check is probably not required.
Other than that looks good. Tested by compiling it.

> - pci_pool_destroy(dev->data_requests);
> +   

Re: [RFC 02/19] dmaengine: pch_dma: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:40PM +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.
> 

Tested by compilation only.

Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@collabora.com>
> ---
>  drivers/dma/pch_dma.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
> index f9028e9..afd8f27 100644
> --- a/drivers/dma/pch_dma.c
> +++ b/drivers/dma/pch_dma.c
> @@ -123,7 +123,7 @@ struct pch_dma_chan {
>  struct pch_dma {
>   struct dma_device   dma;
>   void __iomem *membase;
> - struct pci_pool *pool;
> + struct dma_pool *pool;
>   struct pch_dma_regs regs;
>   struct pch_dma_desc_regs ch_regs[MAX_CHAN_NR];
>   struct pch_dma_chan channels[MAX_CHAN_NR];
> @@ -437,7 +437,7 @@ static struct pch_dma_desc *pdc_alloc_desc(struct 
> dma_chan *chan, gfp_t flags)
>   struct pch_dma *pd = to_pd(chan->device);
>   dma_addr_t addr;
>  
> - desc = pci_pool_zalloc(pd->pool, flags, );
> + desc = dma_pool_zalloc(pd->pool, flags, );
>   if (desc) {
>   INIT_LIST_HEAD(>tx_list);
>   dma_async_tx_descriptor_init(>txd, chan);
> @@ -549,7 +549,7 @@ static void pd_free_chan_resources(struct dma_chan *chan)
>   spin_unlock_irq(_chan->lock);
>  
>   list_for_each_entry_safe(desc, _d, _list, desc_node)
> - pci_pool_free(pd->pool, desc, desc->txd.phys);
> + dma_pool_free(pd->pool, desc, desc->txd.phys);
>  
>   pdc_enable_irq(chan, 0);
>  }
> @@ -880,7 +880,7 @@ static int pch_dma_probe(struct pci_dev *pdev,
>   goto err_iounmap;
>   }
>  
> - pd->pool = pci_pool_create("pch_dma_desc_pool", pdev,
> + pd->pool = dma_pool_create("pch_dma_desc_pool", >dev,
>  sizeof(struct pch_dma_desc), 4, 0);
>   if (!pd->pool) {
>   dev_err(>dev, "Failed to alloc DMA descriptors\n");
> @@ -931,7 +931,7 @@ static int pch_dma_probe(struct pci_dev *pdev,
>   return 0;
>  
>  err_free_pool:
> - pci_pool_destroy(pd->pool);
> + dma_pool_destroy(pd->pool);
>  err_free_irq:
>   free_irq(pdev->irq, pd);
>  err_iounmap:
> @@ -963,7 +963,7 @@ static void pch_dma_remove(struct pci_dev *pdev)
>   tasklet_kill(_chan->tasklet);
>   }
>  
> - pci_pool_destroy(pd->pool);
> + dma_pool_destroy(pd->pool);
>   pci_iounmap(pdev, pd->membase);
>   pci_release_regions(pdev);
>   pci_disable_device(pdev);
> -- 
> 2.9.3
> 


Re: [RFC 13/19] scsi: mvsas: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:51PM +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.
> 
> Signed-off-by: Romain Perier 
> ---
>  drivers/scsi/mvsas/mv_init.c | 4 ++--
>  drivers/scsi/mvsas/mv_sas.c  | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
> index 8280046..451ba93 100644
> --- a/drivers/scsi/mvsas/mv_init.c
> +++ b/drivers/scsi/mvsas/mv_init.c
> @@ -126,7 +126,7 @@ static void mvs_free(struct mvs_info *mvi)
>   slot_nr = MVS_CHIP_SLOT_SZ;
>  
>   if (mvi->dma_pool)
dma_pool_destroy(NULL) is safe and this check is probably not required

> - pci_pool_destroy(mvi->dma_pool);
> + dma_pool_destroy(mvi->dma_pool);
>  
>   if (mvi->tx)
>   dma_free_coherent(mvi->dev,
> @@ -296,7 +296,7 @@ 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, >pdev->dev, 
> MVS_SLOT_BUF_SZ, 16, 0);
line over 80.

>   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, >buf_dma);
> + slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, >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(>entry);
> -- 
> 2.9.3
> 


Re: [RFC 16/19] usb: gadget: net2280: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:54PM +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.
> 
Tested by compilation only.

Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@collabora.com>
> ---
>  drivers/usb/gadget/udc/net2280.c | 12 ++--
>  drivers/usb/gadget/udc/net2280.h |  2 +-
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/net2280.c 
> b/drivers/usb/gadget/udc/net2280.c
> index 8550441..089081e 100644
> --- a/drivers/usb/gadget/udc/net2280.c
> +++ b/drivers/usb/gadget/udc/net2280.c
> @@ -569,7 +569,7 @@ static struct usb_request
>   if (ep->dma) {
>   struct net2280_dma  *td;
>  
> - td = pci_pool_alloc(ep->dev->requests, gfp_flags,
> + td = dma_pool_alloc(ep->dev->requests, gfp_flags,
>   >td_dma);
>   if (!td) {
>   kfree(req);
> @@ -597,7 +597,7 @@ static void net2280_free_request(struct usb_ep *_ep, 
> struct usb_request *_req)
>   req = container_of(_req, struct net2280_request, req);
>   WARN_ON(!list_empty(>queue));
>   if (req->td)
> - pci_pool_free(ep->dev->requests, req->td, req->td_dma);
> + dma_pool_free(ep->dev->requests, req->td, req->td_dma);
>   kfree(req);
>  }
>  
> @@ -3578,10 +3578,10 @@ static void net2280_remove(struct pci_dev *pdev)
>   for (i = 1; i < 5; i++) {
>   if (!dev->ep[i].dummy)
>   continue;
> - pci_pool_free(dev->requests, dev->ep[i].dummy,
> + dma_pool_free(dev->requests, dev->ep[i].dummy,
>   dev->ep[i].td_dma);
>   }
> - pci_pool_destroy(dev->requests);
> + dma_pool_destroy(dev->requests);
>   }
>   if (dev->got_irq)
>   free_irq(pdev->irq, dev);
> @@ -3723,7 +3723,7 @@ static int net2280_probe(struct pci_dev *pdev, const 
> struct pci_device_id *id)
>  
>   /* DMA setup */
>   /* NOTE:  we know only the 32 LSBs of dma addresses may be nonzero */
> - dev->requests = pci_pool_create("requests", pdev,
> + dev->requests = dma_pool_create("requests", >dev,
>   sizeof(struct net2280_dma),
>   0 /* no alignment requirements */,
>   0 /* or page-crossing issues */);
> @@ -3735,7 +3735,7 @@ static int net2280_probe(struct pci_dev *pdev, const 
> struct pci_device_id *id)
>   for (i = 1; i < 5; i++) {
>   struct net2280_dma  *td;
>  
> - td = pci_pool_alloc(dev->requests, GFP_KERNEL,
> + td = dma_pool_alloc(dev->requests, GFP_KERNEL,
>   >ep[i].td_dma);
>   if (!td) {
>   ep_dbg(dev, "can't get dummy %d\n", i);
> diff --git a/drivers/usb/gadget/udc/net2280.h 
> b/drivers/usb/gadget/udc/net2280.h
> index 2736a95..1088c37 100644
> --- a/drivers/usb/gadget/udc/net2280.h
> +++ b/drivers/usb/gadget/udc/net2280.h
> @@ -187,7 +187,7 @@ struct net2280 {
>   struct usb338x_ll_chi_regs  __iomem *ll_chicken_reg;
>   struct usb338x_pl_regs  __iomem *plregs;
>  
> - struct pci_pool *requests;
> + struct dma_pool *requests;
>   /* statistics...*/
>  };
>  
> -- 
> 2.9.3
> 


Re: [RFC 12/19] scsi: mpt3sas: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:50PM +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.
> 
> Signed-off-by: Romain Perier 
> ---
>  drivers/scsi/mpt3sas/mpt3sas_base.c | 64 
> ++---
>  1 file changed, 32 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
> b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index a3fe1fb..092bf31 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -3210,9 +3210,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>   }
>  
>   if (ioc->sense) {
> - pci_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
> + dma_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
>   if (ioc->sense_dma_pool)
dma_pool_destroy(NULL) is safe and this check is probably not required

> - pci_pool_destroy(ioc->sense_dma_pool);
> + dma_pool_destroy(ioc->sense_dma_pool);
>   dexitprintk(ioc, pr_info(MPT3SAS_FMT
>   "sense_pool(0x%p): free\n",
>   ioc->name, ioc->sense));
> @@ -3220,9 +3220,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>   }
>  
>   if (ioc->reply) {
> - pci_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
> + dma_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
>   if (ioc->reply_dma_pool)
dma_pool_destroy(NULL) is safe and this check is probably not required

> - pci_pool_destroy(ioc->reply_dma_pool);
> + dma_pool_destroy(ioc->reply_dma_pool);
>   dexitprintk(ioc, pr_info(MPT3SAS_FMT
>   "reply_pool(0x%p): free\n",
>   ioc->name, ioc->reply));
> @@ -3230,10 +3230,10 @@ _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)
dma_pool_destroy(NULL) is safe and this check is probably not required

> - 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));
> @@ -3244,7 +3244,7 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>   do {
>   rps = >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);
> @@ -3257,7 +3257,7 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  (++i < ioc->reply_queue_count));
>  
>   if (ioc->reply_post_free_dma_pool)
dma_pool_destroy(NULL) is safe and this check is probably not required

> - pci_pool_destroy(ioc->reply_post_free_dma_pool);
> + dma_pool_destroy(ioc->reply_post_free_dma_pool);
>   kfree(ioc->reply_post);
>   }
>  
> @@ -3278,12 +3278,12 @@ _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)
dma_pool_destroy(NULL) is safe and this check is probably not required

> - 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;
>   }
> @@ -3458,23 +3458,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",
> + >pdev->dev, sz, 16, 0);
>   if (!ioc->reply_post_free_dma_pool) {
>   

Re: [RFC 03/19] IB/mthca: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:41PM +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.

Tested by compilation only.

Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> 
> Signed-off-by: Romain Perier <romain.per...@collabora.com>
> ---
>  drivers/infiniband/hw/mthca/mthca_av.c  | 10 +-
>  drivers/infiniband/hw/mthca/mthca_cmd.c |  8 
>  drivers/infiniband/hw/mthca/mthca_dev.h |  4 ++--
>  3 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mthca/mthca_av.c 
> b/drivers/infiniband/hw/mthca/mthca_av.c
> index c9f0f36..9d041b6 100644
> --- a/drivers/infiniband/hw/mthca/mthca_av.c
> +++ b/drivers/infiniband/hw/mthca/mthca_av.c
> @@ -186,7 +186,7 @@ int mthca_create_ah(struct mthca_dev *dev,
>  
>  on_hca_fail:
>   if (ah->type == MTHCA_AH_PCI_POOL) {
> - ah->av = pci_pool_zalloc(dev->av_table.pool,
> + ah->av = dma_pool_zalloc(dev->av_table.pool,
>GFP_ATOMIC, >avdma);
>   if (!ah->av)
>   return -ENOMEM;
> @@ -245,7 +245,7 @@ int mthca_destroy_ah(struct mthca_dev *dev, struct 
> mthca_ah *ah)
>   break;
>  
>   case MTHCA_AH_PCI_POOL:
> - pci_pool_free(dev->av_table.pool, ah->av, ah->avdma);
> + dma_pool_free(dev->av_table.pool, ah->av, ah->avdma);
>   break;
>  
>   case MTHCA_AH_KMALLOC:
> @@ -333,7 +333,7 @@ int mthca_init_av_table(struct mthca_dev *dev)
>   if (err)
>   return err;
>  
> - dev->av_table.pool = pci_pool_create("mthca_av", dev->pdev,
> + dev->av_table.pool = dma_pool_create("mthca_av", >pdev->dev,
>MTHCA_AV_SIZE,
>MTHCA_AV_SIZE, 0);
>   if (!dev->av_table.pool)
> @@ -353,7 +353,7 @@ int mthca_init_av_table(struct mthca_dev *dev)
>   return 0;
>  
>   out_free_pool:
> - pci_pool_destroy(dev->av_table.pool);
> + dma_pool_destroy(dev->av_table.pool);
>  
>   out_free_alloc:
>   mthca_alloc_cleanup(>av_table.alloc);
> @@ -367,6 +367,6 @@ void mthca_cleanup_av_table(struct mthca_dev *dev)
>  
>   if (dev->av_table.av_map)
>   iounmap(dev->av_table.av_map);
> - pci_pool_destroy(dev->av_table.pool);
> + dma_pool_destroy(dev->av_table.pool);
>   mthca_alloc_cleanup(>av_table.alloc);
>  }
> diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c 
> b/drivers/infiniband/hw/mthca/mthca_cmd.c
> index c7f49bb..7f219c8 100644
> --- a/drivers/infiniband/hw/mthca/mthca_cmd.c
> +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
> @@ -530,7 +530,7 @@ int mthca_cmd_init(struct mthca_dev *dev)
>   return -ENOMEM;
>   }
>  
> - dev->cmd.pool = pci_pool_create("mthca_cmd", dev->pdev,
> + dev->cmd.pool = dma_pool_create("mthca_cmd", >pdev->dev,
>   MTHCA_MAILBOX_SIZE,
>   MTHCA_MAILBOX_SIZE, 0);
>   if (!dev->cmd.pool) {
> @@ -543,7 +543,7 @@ int mthca_cmd_init(struct mthca_dev *dev)
>  
>  void mthca_cmd_cleanup(struct mthca_dev *dev)
>  {
> - pci_pool_destroy(dev->cmd.pool);
> + dma_pool_destroy(dev->cmd.pool);
>   iounmap(dev->hcr);
>   if (dev->cmd.flags & MTHCA_CMD_POST_DOORBELLS)
>   iounmap(dev->cmd.dbell_map);
> @@ -613,7 +613,7 @@ struct mthca_mailbox *mthca_alloc_mailbox(struct 
> mthca_dev *dev,
>   if (!mailbox)
>   return ERR_PTR(-ENOMEM);
>  
> - mailbox->buf = pci_pool_alloc(dev->cmd.pool, gfp_mask, >dma);
> + mailbox->buf = dma_pool_alloc(dev->cmd.pool, gfp_mask, >dma);
>   if (!mailbox->buf) {
>   kfree(mailbox);
>   return ERR_PTR(-ENOMEM);
> @@ -627,7 +627,7 @@ void mthca_free_mailbox(struct mthca_dev *dev, struct 
> mthca_mailbox *mailbox)
>   if (!mailbox)
>   return;
>  
> - pci_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma);
> + dma_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma);
>   kfree(mailbox);
>  }
>  
> diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h 
> b/drivers/infiniband/hw/mthca/mthca_dev.h
> index 4393a02..8c3f6ed 100644
> --- a/drivers/infiniband/hw/mthca/mthca_dev.h
> +++ b/drivers/infiniban

Re: [RFC 01/19] block: DAC960: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:39PM +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.
> 
> Signed-off-by: Romain Perier <romain.per...@collabora.com>

Tested by compilation only. Some whitespace errors, but the patch do not
add new ones.

Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> ---
>  drivers/block/DAC960.c | 36 ++--
>  drivers/block/DAC960.h |  4 ++--
>  2 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
> index 26a51be..2b221cc 100644
> --- a/drivers/block/DAC960.c
> +++ b/drivers/block/DAC960.c
> @@ -268,17 +268,17 @@ static bool 
> DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
>void *AllocationPointer = NULL;
>void *ScatterGatherCPU = NULL;
>dma_addr_t ScatterGatherDMA;
> -  struct pci_pool *ScatterGatherPool;
> +  struct dma_pool *ScatterGatherPool;
>void *RequestSenseCPU = NULL;
>dma_addr_t RequestSenseDMA;
> -  struct pci_pool *RequestSensePool = NULL;
> +  struct dma_pool *RequestSensePool = NULL;
>  
>if (Controller->FirmwareType == DAC960_V1_Controller)
>  {
>CommandAllocationLength = offsetof(DAC960_Command_T, V1.EndMarker);
>CommandAllocationGroupSize = DAC960_V1_CommandAllocationGroupSize;
> -  ScatterGatherPool = pci_pool_create("DAC960_V1_ScatterGather",
> - Controller->PCIDevice,
> +  ScatterGatherPool = dma_pool_create("DAC960_V1_ScatterGather",
> + >PCIDevice->dev,
>   DAC960_V1_ScatterGatherLimit * sizeof(DAC960_V1_ScatterGatherSegment_T),
>   sizeof(DAC960_V1_ScatterGatherSegment_T), 0);
>if (ScatterGatherPool == NULL)
> @@ -290,18 +290,18 @@ static bool 
> DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
>  {
>CommandAllocationLength = offsetof(DAC960_Command_T, V2.EndMarker);
>CommandAllocationGroupSize = DAC960_V2_CommandAllocationGroupSize;
> -  ScatterGatherPool = pci_pool_create("DAC960_V2_ScatterGather",
> - Controller->PCIDevice,
> +  ScatterGatherPool = dma_pool_create("DAC960_V2_ScatterGather",
> + >PCIDevice->dev,
>   DAC960_V2_ScatterGatherLimit * sizeof(DAC960_V2_ScatterGatherSegment_T),
>   sizeof(DAC960_V2_ScatterGatherSegment_T), 0);
>if (ScatterGatherPool == NULL)
>   return DAC960_Failure(Controller,
>   "AUXILIARY STRUCTURE CREATION (SG)");
> -  RequestSensePool = pci_pool_create("DAC960_V2_RequestSense",
> - Controller->PCIDevice, sizeof(DAC960_SCSI_RequestSense_T),
> +  RequestSensePool = dma_pool_create("DAC960_V2_RequestSense",
> + >PCIDevice->dev, sizeof(DAC960_SCSI_RequestSense_T),
>   sizeof(int), 0);
>if (RequestSensePool == NULL) {
> - pci_pool_destroy(ScatterGatherPool);
> + dma_pool_destroy(ScatterGatherPool);
>   return DAC960_Failure(Controller,
>   "AUXILIARY STRUCTURE CREATION (SG)");
>}
> @@ -335,16 +335,16 @@ static bool 
> DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
>Command->Next = Controller->FreeCommands;
>Controller->FreeCommands = Command;
>Controller->Commands[CommandIdentifier-1] = Command;
> -  ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, GFP_ATOMIC,
> +  ScatterGatherCPU = dma_pool_alloc(ScatterGatherPool, GFP_ATOMIC,
>   );
>if (ScatterGatherCPU == NULL)
> return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION");
>  
>if (RequestSensePool != NULL) {
> -   RequestSenseCPU = pci_pool_alloc(RequestSensePool, GFP_ATOMIC,
> +   RequestSenseCPU = dma_pool_alloc(RequestSensePool, GFP_ATOMIC,
>   );
> if (RequestSenseCPU == NULL) {
> -pci_pool_free(ScatterGatherPool, ScatterGatherCPU,
> +dma_pool_free(ScatterGatherPool, ScatterGatherCPU,
>  ScatterGatherDMA);
>   return DAC960_Failure(Controller,
>   "AUXILIARY STRUCTURE CREATION");
> @@ -379,8 +379,8 @@ static bool 
> DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
>  static void DAC960_DestroyAuxiliaryStructures(DAC960_Controller_T 
> *Controller)

Re: [RFC 06/19] mlx5: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:44PM +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.



> 
> Signed-off-by: Romain Perier 
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 10 +-
>  include/linux/mlx5/driver.h   |  2 +-
>  2 files changed, 6 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..7885e2b 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,
>  >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,7 @@ 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", >pdev->dev, size, align, 
> 0);
This introduces line over 80 characters warning. Please fix and
resubmit. Other than that, looks good. I tested by compiling it.

>   if (!cmd->pool)
>   return -ENOMEM;
>  
> @@ -1786,7 +1786,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 +1800,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
> 


Re: [RFC 09/19] scsi: csiostor: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:47PM +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.
> 
> Signed-off-by: Romain Perier 
> ---
>  drivers/scsi/csiostor/csio_hw.h   | 2 +-
>  drivers/scsi/csiostor/csio_init.c | 4 ++--
>  drivers/scsi/csiostor/csio_scsi.c | 6 +++---
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h
> index 029bef8..c35c7bf 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_pci_pool; /* PCI 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..6206a72 100644
> --- a/drivers/scsi/csiostor/csio_init.c
> +++ b/drivers/scsi/csiostor/csio_init.c
> @@ -485,7 +485,7 @@ 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,
> + hw->scsi_pci_pool = dma_pool_create("csio_scsi_pci_pool", 
> >pdev->dev,
Introduces line over 80 characters warning. Please fix and resubmit.
Other than that looks good. Tested by compiling it.

>   CSIO_SCSI_RSP_LEN, 8, 0);
>   if (!hw->scsi_pci_pool)
>   goto err_free_rn_pool;
> @@ -505,7 +505,7 @@ csio_resource_alloc(struct csio_hw *hw)
>  static void
>  csio_resource_free(struct csio_hw *hw)
>  {
> - pci_pool_destroy(hw->scsi_pci_pool);
> + dma_pool_destroy(hw->scsi_pci_pool);
>   hw->scsi_pci_pool = NULL;
>   mempool_destroy(hw->rnode_mempool);
>   hw->rnode_mempool = NULL;
> diff --git a/drivers/scsi/csiostor/csio_scsi.c 
> b/drivers/scsi/csiostor/csio_scsi.c
> index a1ff75f..49b36b0 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 = >dma_buf;
> - dma_buf->vaddr = pci_pool_alloc(hw->scsi_pci_pool, GFP_KERNEL,
> + dma_buf->vaddr = dma_pool_alloc(hw->scsi_pci_pool, GFP_KERNEL,
>   _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 = >dma_buf;
> - pci_pool_free(hw->scsi_pci_pool, dma_buf->vaddr,
> + dma_pool_free(hw->scsi_pci_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 = >dma_buf;
> - pci_pool_free(scm->hw->scsi_pci_pool, dma_buf->vaddr,
> + dma_pool_free(scm->hw->scsi_pci_pool, dma_buf->vaddr,
> dma_buf->paddr);
>  
>   kfree(ioreq);
> -- 
> 2.9.3
> 


Re: [RFC 08/19] scsi: be2iscsi: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:46PM +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.
> 
Tested by compilation only.

Acked-by: Peter Senna Tschudin <peter.se...@collabora.com>
Tested-by: Peter Senna Tschudin <peter.se...@collabora.com>
> Signed-off-by: Romain Perier <romain.per...@collabora.com>
> ---
>  drivers/scsi/be2iscsi/be_iscsi.c | 6 +++---
>  drivers/scsi/be2iscsi/be_main.c  | 6 +++---
>  drivers/scsi/be2iscsi/be_main.h  | 2 +-
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_iscsi.c 
> b/drivers/scsi/be2iscsi/be_iscsi.c
> index a484457..d76ef77 100644
> --- a/drivers/scsi/be2iscsi/be_iscsi.c
> +++ b/drivers/scsi/be2iscsi/be_iscsi.c
> @@ -87,8 +87,8 @@ struct iscsi_cls_session *beiscsi_session_create(struct 
> iscsi_endpoint *ep,
>   return NULL;
>   sess = cls_session->dd_data;
>   beiscsi_sess = sess->dd_data;
> - beiscsi_sess->bhs_pool =  pci_pool_create("beiscsi_bhs_pool",
> -phba->pcidev,
> + beiscsi_sess->bhs_pool =  dma_pool_create("beiscsi_bhs_pool",
> +>pcidev->dev,
>  sizeof(struct be_cmd_bhs),
>  64, 0);
>   if (!beiscsi_sess->bhs_pool)
> @@ -113,7 +113,7 @@ void beiscsi_session_destroy(struct iscsi_cls_session 
> *cls_session)
>   struct beiscsi_session *beiscsi_sess = sess->dd_data;
>  
>   printk(KERN_INFO "In beiscsi_session_destroy\n");
> - pci_pool_destroy(beiscsi_sess->bhs_pool);
> + dma_pool_destroy(beiscsi_sess->bhs_pool);
>   iscsi_session_teardown(cls_session);
>  }
>  
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 32b2713..dd43480 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -4307,7 +4307,7 @@ static void beiscsi_cleanup_task(struct iscsi_task 
> *task)
>   pwrb_context = _ctrlr->wrb_context[cri_index];
>  
>   if (io_task->cmd_bhs) {
> - pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
> + dma_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
> io_task->bhs_pa.u.a64.address);
>   io_task->cmd_bhs = NULL;
>   task->hdr = NULL;
> @@ -4424,7 +4424,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, 
> uint8_t opcode)
>   struct beiscsi_session *beiscsi_sess = beiscsi_conn->beiscsi_sess;
>   dma_addr_t paddr;
>  
> - io_task->cmd_bhs = pci_pool_alloc(beiscsi_sess->bhs_pool,
> + io_task->cmd_bhs = dma_pool_alloc(beiscsi_sess->bhs_pool,
> GFP_ATOMIC, );
>   if (!io_task->cmd_bhs)
>   return -ENOMEM;
> @@ -4551,7 +4551,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, 
> uint8_t opcode)
>   if (io_task->pwrb_handle)
>   free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle);
>   io_task->pwrb_handle = NULL;
> - pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
> + dma_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
> io_task->bhs_pa.u.a64.address);
>   io_task->cmd_bhs = NULL;
>   return -ENOMEM;
> diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
> index 2188579..cf58d31 100644
> --- a/drivers/scsi/be2iscsi/be_main.h
> +++ b/drivers/scsi/be2iscsi/be_main.h
> @@ -446,7 +446,7 @@ struct beiscsi_hba {
>test_bit(BEISCSI_HBA_ONLINE, >state))
>  
>  struct beiscsi_session {
> - struct pci_pool *bhs_pool;
> + struct dma_pool *bhs_pool;
>  };
>  
>  /**
> -- 
> 2.9.3
> 


Re: [RFC 07/19] wireless: ipw2200: Replace PCI pool old API

2017-02-08 Thread Peter Senna Tschudin
On Wed, Feb 08, 2017 at 05:34:45PM +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.



> 
> Signed-off-by: Romain Perier 
> ---
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c 
> b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> index 5ef3c5c..6d77870 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,9 @@ 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", >pci_dev->dev, CB_MAX_LENGTH, 
> 0, 0);
Introduces line over 80 characters warning. Please fix and resubmit.
Other than that looks good. Tested by compiling it.
>   if (!pool) {
> - IPW_ERROR("pci_pool_create failed\n");
> + IPW_ERROR("dma_pool_create failed\n");
>   kfree(phys);
>   kfree(virts);
>   return -ENOMEM;
> @@ -3255,7 +3255,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,
>[total_nr]);
>   if (!virts[total_nr]) {
>   ret = -ENOMEM;
> @@ -3299,9 +3299,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
> 


[PATCH 1/1] igb: Fix hw_dbg logging in igb_update_flash_i210

2017-01-02 Thread Peter Senna Tschudin
From: Hannu Lounento <hannu.loune...@ge.com>

Fix an if statement with hw_dbg lines where the logic was inverted with
regards to the corresponding return value used in the if statement.

Signed-off-by: Hannu Lounento <hannu.loune...@ge.com>
Signed-off-by: Peter Senna Tschudin <peter.se...@collabora.com>
---
 drivers/net/ethernet/intel/igb/e1000_i210.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c 
b/drivers/net/ethernet/intel/igb/e1000_i210.c
index 8aa7987..07d48f2 100644
--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
+++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
@@ -699,9 +699,9 @@ static s32 igb_update_flash_i210(struct e1000_hw *hw)
 
ret_val = igb_pool_flash_update_done_i210(hw);
if (ret_val)
-   hw_dbg("Flash update complete\n");
-   else
hw_dbg("Flash update time out\n");
+   else
+   hw_dbg("Flash update complete\n");
 
 out:
return ret_val;
-- 
2.5.5