Re: [PATCH 3/3] PCI: remove pci_set_dma_max_seg_size

From: Bjorn Helgaas
Date: Wed Oct 10 2018 - 16:45:19 EST


[+cc maintainers]

On Tue, Oct 09, 2018 at 04:08:24PM +0200, Christoph Hellwig wrote:
> The few callers can just use dma_set_max_seg_size directly.

I intend to apply this, just FYI about these trivial changes to your
drivers.

> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
> drivers/ata/sata_inic162x.c | 2 +-
> drivers/block/rsxx/core.c | 2 +-
> drivers/pci/probe.c | 2 +-
> drivers/s390/net/ism_drv.c | 2 +-
> drivers/scsi/aacraid/linit.c | 2 +-
> include/linux/pci-dma-compat.h | 9 ---------
> 6 files changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
> index 9b6d7930d1c7..e0bcf9b2dab0 100644
> --- a/drivers/ata/sata_inic162x.c
> +++ b/drivers/ata/sata_inic162x.c
> @@ -873,7 +873,7 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
> * like others but it will lock up the whole machine HARD if
> * 65536 byte PRD entry is fed. Reduce maximum segment size.
> */
> - rc = pci_set_dma_max_seg_size(pdev, 65536 - 512);
> + rc = dma_set_max_seg_size(&pdev->dev, 65536 - 512);
> if (rc) {
> dev_err(&pdev->dev, "failed to set the maximum segment size\n");
> return rc;
> diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
> index f2c631ce793c..37df486c7c3c 100644
> --- a/drivers/block/rsxx/core.c
> +++ b/drivers/block/rsxx/core.c
> @@ -780,7 +780,7 @@ static int rsxx_pci_probe(struct pci_dev *dev,
> goto failed_enable;
>
> pci_set_master(dev);
> - pci_set_dma_max_seg_size(dev, RSXX_HW_BLK_SIZE);
> + dma_set_max_seg_size(&dev->dev, RSXX_HW_BLK_SIZE);
>
> st = pci_set_dma_mask(dev, DMA_BIT_MASK(64));
> if (st) {
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index fc6340d76814..f97513b3d030 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2397,7 +2397,7 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
> dev->dev.dma_parms = &dev->dma_parms;
> dev->dev.coherent_dma_mask = 0xffffffffull;
>
> - pci_set_dma_max_seg_size(dev, 65536);
> + dma_set_max_seg_size(&dev->dev, 65536);
> dma_set_seg_boundary(&dev->dev, 0xffffffff);
>
> /* Fix up broken headers */
> diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
> index 8688c0fff761..f96ec68af2e5 100644
> --- a/drivers/s390/net/ism_drv.c
> +++ b/drivers/s390/net/ism_drv.c
> @@ -516,7 +516,7 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> goto err_unmap;
>
> dma_set_seg_boundary(&pdev->dev, SZ_1M - 1);
> - pci_set_dma_max_seg_size(pdev, SZ_1M);
> + dma_set_max_seg_size(&pdev->dev, SZ_1M);
> pci_set_master(pdev);
>
> ism->smcd = smcd_alloc_dev(&pdev->dev, dev_name(&pdev->dev), &ism_ops,
> diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
> index 04443577d48b..53eb2e9569b9 100644
> --- a/drivers/scsi/aacraid/linit.c
> +++ b/drivers/scsi/aacraid/linit.c
> @@ -1747,7 +1747,7 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
> shost->max_sectors = (shost->sg_tablesize * 8) + 112;
> }
>
> - error = pci_set_dma_max_seg_size(pdev,
> + error = dma_set_max_seg_size(&pdev->dev,
> (aac->adapter_info.options & AAC_OPT_NEW_COMM) ?
> (shost->max_sectors << 9) : 65536);
> if (error)
> diff --git a/include/linux/pci-dma-compat.h b/include/linux/pci-dma-compat.h
> index 558a109ab497..cb1adf0b78a9 100644
> --- a/include/linux/pci-dma-compat.h
> +++ b/include/linux/pci-dma-compat.h
> @@ -119,20 +119,11 @@ static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
> {
> return dma_set_coherent_mask(&dev->dev, mask);
> }
> -
> -static inline int pci_set_dma_max_seg_size(struct pci_dev *dev,
> - unsigned int size)
> -{
> - return dma_set_max_seg_size(&dev->dev, size);
> -}
> #else
> static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
> { return -EIO; }
> static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
> { return -EIO; }
> -static inline int pci_set_dma_max_seg_size(struct pci_dev *dev,
> - unsigned int size)
> -{ return -EIO; }
> #endif
>
> #endif
> --
> 2.19.0
>