Skip to contentSkip to conversation

PCI: Remove the unused pci wrappers

PATCH In review Cai Huoqing 2 participants 3 messages Sep 25, 2021 – Sep 26, 2021 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Remove the unused pci wrappers

The wrappers in include/linux/pci-dma-compat.h should go away, so remove the unused pci wrappers.
Prefer using dma_xxx() instead of the pci wrappers pci_xxx().

---
 include/linux/pci-dma-compat.h | 27 ---------------------------
 1 file changed, 27 deletions(-)
include/linux/pci-dma-compat.h +0 -27
index 249d4d7fbf18..33b316f38e1d 100644
@@ -20,13 +20,6 @@ pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
 	return dma_alloc_coherent(&hwdev->dev, size, dma_handle, GFP_ATOMIC);
 }
 
-static inline void *
-pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
-		      dma_addr_t *dma_handle)
-{
-	return dma_alloc_coherent(&hwdev->dev, size, dma_handle, GFP_ATOMIC);
-}
-
 static inline void
 pci_free_consistent(struct pci_dev *hwdev, size_t size,
 		    void *vaddr, dma_addr_t dma_handle)
@@ -89,26 +82,6 @@ pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
 	dma_sync_single_for_device(&hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
 }
 
-static inline void
-pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
-		int nelems, int direction)
-{
-	dma_sync_sg_for_cpu(&hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
-}
-
-static inline void
-pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
-		int nelems, int direction)
-{
-	dma_sync_sg_for_device(&hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
-}
-
-static inline int
-pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
-{
-	return dma_mapping_error(&pdev->dev, dma_addr);
-}
-
 #ifdef CONFIG_PCI
 static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
 {
Signature · 1 line
2.25.1
#1 lore raw

Le 25/09/2021 à 15:52, Cai Huoqing a écrit :

Quoted 45 lines

The wrappers in include/linux/pci-dma-compat.h should go away, so remove the unused pci wrappers.
Prefer using dma_xxx() instead of the pci wrappers pci_xxx().

---
  include/linux/pci-dma-compat.h | 27 ---------------------------
  1 file changed, 27 deletions(-)
include/linux/pci-dma-compat.h +0 -20
index 249d4d7fbf18..33b316f38e1d 100644
@@ -20,13 +20,6 @@ pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
  	return dma_alloc_coherent(&hwdev->dev, size, dma_handle, GFP_ATOMIC);
  }
 
-static inline void *
-pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
-		      dma_addr_t *dma_handle)
-{
-	return dma_alloc_coherent(&hwdev->dev, size, dma_handle, GFP_ATOMIC);
-}
-
  static inline void
  pci_free_consistent(struct pci_dev *hwdev, size_t size,
  		    void *vaddr, dma_addr_t dma_handle)
@@ -89,26 +82,6 @@ pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
  	dma_sync_single_for_device(&hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
  }
 
-static inline void
-pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
-		int nelems, int direction)
-{
-	dma_sync_sg_for_cpu(&hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
-}
-
-static inline void
-pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
-		int nelems, int direction)
-{
-	dma_sync_sg_for_device(&hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
-}

include/linux/pci-dma-compat.h pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, · line 87

Quoted 10 lines
include/linux/pci-dma-compat.h +0 -7
-
-static inline int
-pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
-{
-	return dma_mapping_error(&pdev->dev, dma_addr);
-}
-
  #ifdef CONFIG_PCI
  static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
  {

Hi,

I'm not sure that this step is needed.
The whole pci-dma-compat.h is close to be obsolete. So axing just a part of it now is not that really useful.

After many patches, there is now just a few users of this deprecated API. All steps to finalize the job have already been posted [1] and a plan has been proposed by Arnd Bergmann to have the remaining ones merged in the tree [2].

Some of the message/fusion patches have been re-sent yesterday and today to the scsi maintainer in order to have them merged.

BTW, Cai Huoqing, thanks a lot for taking care and proposing the needed clean-ups in comments and log messages. Looking at it was the next item of my to-do list, but I'm really pleased to get some help here to finalize the job once and for all.

CJ

[1]: https://lore.kernel.org/kernel-janitors/[email protected]/

[2]: https://lore.kernel.org/kernel-janitors/CAK8P3a2CBvw_GP372R+p8f4_pa82sMuQ5iHk4Nb2dJCzm_Fivw@mail.gmail.com/

#2 lore raw
Quoted 57 lines · Christophe JAILLET

Le 25/09/2021 à 15:52, Cai Huoqing a écrit :

Quoted 43 lines

The wrappers in include/linux/pci-dma-compat.h should go away, so remove the unused pci wrappers.
Prefer using dma_xxx() instead of the pci wrappers pci_xxx().

---
  include/linux/pci-dma-compat.h | 27 ---------------------------
  1 file changed, 27 deletions(-)
include/linux/pci-dma-compat.h +0 -21
index 249d4d7fbf18..33b316f38e1d 100644
@@ -20,13 +20,6 @@ pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
  	return dma_alloc_coherent(&hwdev->dev, size, dma_handle, GFP_ATOMIC);
  }
-static inline void *
-pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
-		      dma_addr_t *dma_handle)
-{
-	return dma_alloc_coherent(&hwdev->dev, size, dma_handle, GFP_ATOMIC);
-}
-
  static inline void
  pci_free_consistent(struct pci_dev *hwdev, size_t size,
  		    void *vaddr, dma_addr_t dma_handle)
@@ -89,26 +82,6 @@ pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
  	dma_sync_single_for_device(&hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
  }
-static inline void
-pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
-		int nelems, int direction)
-{
-	dma_sync_sg_for_cpu(&hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
-}
-
-static inline void
-pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
-		int nelems, int direction)
-{
-	dma_sync_sg_for_device(&hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
-}
-

include/linux/pci-dma-compat.h pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, · line 87

Quoted 10 lines
include/linux/pci-dma-compat.h +0 -6
-static inline int
-pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
-{
-	return dma_mapping_error(&pdev->dev, dma_addr);
-}
-
  #ifdef CONFIG_PCI
  static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
  {
 

Hi,

Quoted 3 lines

I'm not sure that this step is needed.
The whole pci-dma-compat.h is close to be obsolete. So axing just a part of it now is not that really useful.

Thanks for your feedback.

If someone reuse these wrappers, that will not be checked by checkpatch.pl. And I also will not add check condition to checkpatch.pl, because the wrappers in include/linux/pci-dma-compat.h will go away soon.

Removing these API helps driver owner to avoid reusing these obsolete wrappers without reviwing it manually, only works before pci-dma-compat.h is droped.

Thanks
Cai

Quoted 5 lines

After many patches, there is now just a few users of this deprecated API. All steps to finalize the job have already been posted [1] and a plan has been proposed by Arnd Bergmann to have the remaining ones merged in the tree
[2]

it maybe cost serval weeks before all subtrees merge to linux-next.

Quoted 15 lines

Some of the message/fusion patches have been re-sent yesterday and today to the scsi maintainer in order to have them merged.

BTW, Cai Huoqing, thanks a lot for taking care and proposing the needed clean-ups in comments and log messages.
Looking at it was the next item of my to-do list, but I'm really pleased to get some help here to finalize the job once and for all.

CJ

[1]: https://lore.kernel.org/kernel-janitors/[email protected]/

[2]: https://lore.kernel.org/kernel-janitors/CAK8P3a2CBvw_GP372R+p8f4_pa82sMuQ5iHk4Nb2dJCzm_Fivw@mail.gmail.com/