[v2,02/15] bus/pci: add const to some experimental API

Message ID 20230821113549.3191921-3-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Cleanup PCI(e) drivers |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

David Marchand Aug. 21, 2023, 11:35 a.m. UTC
  Those functions are fine with a const on the device pointer.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/bus/pci/pci_common.c  | 4 ++--
 drivers/bus/pci/rte_bus_pci.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Tyler Retzlaff Aug. 21, 2023, 4:14 p.m. UTC | #1
On Mon, Aug 21, 2023 at 01:35:35PM +0200, David Marchand wrote:
> Those functions are fine with a const on the device pointer.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
  
Chenbo Xia Sept. 6, 2023, 1:02 p.m. UTC | #2
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Monday, August 21, 2023 7:36 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; ferruh.yigit@amd.com; Xia, Chenbo
> <chenbo.xia@intel.com>; nipun.gupta@amd.com; Richardson, Bruce
> <bruce.richardson@intel.com>
> Subject: [PATCH v2 02/15] bus/pci: add const to some experimental API
> 
> Those functions are fine with a const on the device pointer.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  drivers/bus/pci/pci_common.c  | 4 ++--
>  drivers/bus/pci/rte_bus_pci.h | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
> index 52404ab0fe..382b0b8946 100644
> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -814,7 +814,7 @@ rte_pci_get_iommu_class(void)
>  }
> 
>  off_t
> -rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap)
> +rte_pci_find_ext_capability(const struct rte_pci_device *dev, uint32_t
> cap)
>  {
>  	off_t offset = RTE_PCI_CFG_SPACE_SIZE;
>  	uint32_t header;
> @@ -857,7 +857,7 @@ rte_pci_find_ext_capability(struct rte_pci_device *dev,
> uint32_t cap)
>  }
> 
>  int
> -rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable)
> +rte_pci_set_bus_master(const struct rte_pci_device *dev, bool enable)
>  {
>  	uint16_t old_cmd, cmd;
> 
> diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
> index 9d59c4aef3..75d0030eae 100644
> --- a/drivers/bus/pci/rte_bus_pci.h
> +++ b/drivers/bus/pci/rte_bus_pci.h
> @@ -85,7 +85,7 @@ void rte_pci_dump(FILE *f);
>   *  = 0: Device does not support it.
>   */
>  __rte_experimental
> -off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t
> cap);
> +off_t rte_pci_find_ext_capability(const struct rte_pci_device *dev,
> uint32_t cap);
> 
>  /**
>   * Enables/Disables Bus Master for device's PCI command register.
> @@ -99,7 +99,7 @@ off_t rte_pci_find_ext_capability(struct rte_pci_device
> *dev, uint32_t cap);
>   *  0 on success, -1 on error in PCI config space read/write.
>   */
>  __rte_experimental
> -int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable);
> +int rte_pci_set_bus_master(const struct rte_pci_device *dev, bool enable);
> 
>  /**
>   * Read PCI config space.
> --
> 2.41.0

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  

Patch

diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 52404ab0fe..382b0b8946 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -814,7 +814,7 @@  rte_pci_get_iommu_class(void)
 }
 
 off_t
-rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap)
+rte_pci_find_ext_capability(const struct rte_pci_device *dev, uint32_t cap)
 {
 	off_t offset = RTE_PCI_CFG_SPACE_SIZE;
 	uint32_t header;
@@ -857,7 +857,7 @@  rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap)
 }
 
 int
-rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable)
+rte_pci_set_bus_master(const struct rte_pci_device *dev, bool enable)
 {
 	uint16_t old_cmd, cmd;
 
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 9d59c4aef3..75d0030eae 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -85,7 +85,7 @@  void rte_pci_dump(FILE *f);
  *  = 0: Device does not support it.
  */
 __rte_experimental
-off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap);
+off_t rte_pci_find_ext_capability(const struct rte_pci_device *dev, uint32_t cap);
 
 /**
  * Enables/Disables Bus Master for device's PCI command register.
@@ -99,7 +99,7 @@  off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap);
  *  0 on success, -1 on error in PCI config space read/write.
  */
 __rte_experimental
-int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable);
+int rte_pci_set_bus_master(const struct rte_pci_device *dev, bool enable);
 
 /**
  * Read PCI config space.