On Thu, Aug 3, 2023 at 11:47 AM Bruce Richardson
<bruce.richard...@intel.com> wrote:
>
> On Thu, Aug 03, 2023 at 09:50:25AM +0200, David Marchand wrote:
> > Those functions are fine with a const on the device pointer.
> >
> > Signed-off-by: David Marchand <david.march...@redhat.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;
> >
>
> While generally I'm a big fan of using const everywhere we can, I wonder if
> this is confusing here, since you are changing a setting, i.e. it's not
> a read-only function.

Changing a setting in the underlying hardware, yes, but the C object
is left untouched.


-- 
David Marchand

Reply via email to